Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix users had already joined a workspace, but the system still first … (#9834)

G81192a17f169e01fc
diff --git a/api/services/account_service.py b/api/services/account_service.py
index 412685147c8..27b1540c8d7 100644
--- a/api/services/account_service.py
+++ b/api/services/account_service.py
@@ -505,9 +505,7 @@ class TenantService:
def create_owner_tenant_if_not_exist(
account: Account, name: Optional[str] = None, is_setup: Optional[bool] = False
):
- """Create owner tenant if not exist"""
- if not FeatureService.get_system_features().is_allow_create_workspace and not is_setup:
- raise WorkSpaceNotAllowedCreateError()
+ """Check if user have a workspace or not"""
available_ta = (
TenantAccountJoin.query.filter_by(account_id=account.id).order_by(TenantAccountJoin.id.asc()).first()
)
@@ -515,6 +513,10 @@ class TenantService:
if available_ta:
return
+ """Create owner tenant if not exist"""
+ if not FeatureService.get_system_features().is_allow_create_workspace and not is_setup:
+ raise WorkSpaceNotAllowedCreateError()
+
if name:
tenant = TenantService.create_tenant(name=name, is_setup=is_setup)
else: