Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: --name option for the create-tenant command does not take effect #11993

Merged
merged 1 commit into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions api/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion api/services/account_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
crazywoola marked this conversation as resolved.
Show resolved Hide resolved
) -> Account:
db.session.begin_nested()
"""Register account"""
Expand All @@ -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
Expand Down
Loading