Skip to content

Commit 4ee49f3

Browse files
zalcitzhuqingchaocrazywoola
authored
chore: remove weird account login (#22247)
Co-authored-by: zhuqingchao <zhuqingchao@xiaomi.com> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
1 parent f6059ef commit 4ee49f3

File tree

2 files changed

+1
-21
lines changed

2 files changed

+1
-21
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ sdks/python-client/dify_client.egg-info
198198
!.vscode/launch.json.template
199199
!.vscode/README.md
200200
api/.vscode
201+
web/.vscode
201202
# vscode Code History Extension
202203
.history
203204

api/controllers/service_api/wraps.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,6 @@ def decorated_view(*args, **kwargs):
6363
if tenant.status == TenantStatus.ARCHIVE:
6464
raise Forbidden("The workspace's status is archived.")
6565

66-
tenant_account_join = (
67-
db.session.query(Tenant, TenantAccountJoin)
68-
.where(Tenant.id == api_token.tenant_id)
69-
.where(TenantAccountJoin.tenant_id == Tenant.id)
70-
.where(TenantAccountJoin.role.in_(["owner"]))
71-
.where(Tenant.status == TenantStatus.NORMAL)
72-
.one_or_none()
73-
) # TODO: only owner information is required, so only one is returned.
74-
if tenant_account_join:
75-
tenant, ta = tenant_account_join
76-
account = db.session.query(Account).where(Account.id == ta.account_id).first()
77-
# Login admin
78-
if account:
79-
account.current_tenant = tenant
80-
current_app.login_manager._update_request_context_with_user(account) # type: ignore
81-
user_logged_in.send(current_app._get_current_object(), user=_get_user()) # type: ignore
82-
else:
83-
raise Unauthorized("Tenant owner account does not exist.")
84-
else:
85-
raise Unauthorized("Tenant does not exist.")
86-
8766
kwargs["app_model"] = app_model
8867

8968
if fetch_user_arg:

0 commit comments

Comments
 (0)