From 78bd68bd66f2db7c04477d11d0327f3ab4eb4000 Mon Sep 17 00:00:00 2001 From: eux Date: Mon, 23 Dec 2024 14:24:56 +0800 Subject: [PATCH] fix: --name option for the create-tenant command does not take effect --- api/commands.py | 9 +++++++-- api/services/account_service.py | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/api/commands.py b/api/commands.py index bf013cc77e0627..dff5c2e41c98dc 100644 --- a/api/commands.py +++ b/api/commands.py @@ -562,8 +562,13 @@ def create_tenant(email: str, language: Optional[str] = None, name: Optional[str new_password = secrets.token_urlsafe(16) # register account - account = RegisterService.register(email=email, name=account_name, password=new_password, language=language) - + account = RegisterService.register( + email=email, + name=account_name, + password=new_password, + language=language, + create_workspace_required=False, + ) TenantService.create_owner_tenant_if_not_exist(account, name) click.echo( diff --git a/api/services/account_service.py b/api/services/account_service.py index 22b54a3ab87473..929bed7705c782 100644 --- a/api/services/account_service.py +++ b/api/services/account_service.py @@ -793,6 +793,7 @@ def register( language: Optional[str] = None, status: Optional[AccountStatus] = None, is_setup: Optional[bool] = False, + create_workspace_required: Optional[bool] = True, ) -> Account: db.session.begin_nested() """Register account""" @@ -810,7 +811,7 @@ def register( if open_id is not None or provider is not None: AccountService.link_account_integrate(provider, open_id, account) - if FeatureService.get_system_features().is_allow_create_workspace: + if FeatureService.get_system_features().is_allow_create_workspace and create_workspace_required: tenant = TenantService.create_tenant(f"{account.name}'s Workspace") TenantService.create_tenant_member(tenant, account, role="owner") account.current_tenant = tenant