fix: multiple rows were found correctly (#2219)
This commit is contained in:
parent
2068ae215e
commit
828822243a
13 changed files with 49 additions and 48 deletions
|
|
@ -76,7 +76,7 @@ def validate_dataset_token(view=None):
|
|||
.filter(Tenant.id == api_token.tenant_id) \
|
||||
.filter(TenantAccountJoin.tenant_id == Tenant.id) \
|
||||
.filter(TenantAccountJoin.role.in_(['owner'])) \
|
||||
.one_or_none()
|
||||
.one_or_none() # TODO: only owner information is required, so only one is returned.
|
||||
if tenant_account_join:
|
||||
tenant, ta = tenant_account_join
|
||||
account = Account.query.filter_by(id=ta.account_id).first()
|
||||
|
|
@ -86,9 +86,9 @@ def validate_dataset_token(view=None):
|
|||
current_app.login_manager._update_request_context_with_user(account)
|
||||
user_logged_in.send(current_app._get_current_object(), user=_get_user())
|
||||
else:
|
||||
raise Unauthorized("Tenant owner account is not exist.")
|
||||
raise Unauthorized("Tenant owner account does not exist.")
|
||||
else:
|
||||
raise Unauthorized("Tenant is not exist.")
|
||||
raise Unauthorized("Tenant does not exist.")
|
||||
return view(api_token.tenant_id, *args, **kwargs)
|
||||
return decorated
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue