mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-15 11:06:00 +08:00
fix removing member without permission (#16332)
Co-authored-by: crazywoola <427733928@qq.com>
This commit is contained in:
parent
437dcbdd68
commit
8996c1da29
@ -785,9 +785,11 @@ class TenantService:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def remove_member_from_tenant(tenant: Tenant, account: Account, operator: Account) -> None:
|
def remove_member_from_tenant(tenant: Tenant, account: Account, operator: Account) -> None:
|
||||||
"""Remove member from tenant"""
|
"""Remove member from tenant"""
|
||||||
if operator.id == account.id and TenantService.check_member_permission(tenant, operator, account, "remove"):
|
if operator.id == account.id:
|
||||||
raise CannotOperateSelfError("Cannot operate self.")
|
raise CannotOperateSelfError("Cannot operate self.")
|
||||||
|
|
||||||
|
TenantService.check_member_permission(tenant, operator, account, "remove")
|
||||||
|
|
||||||
ta = TenantAccountJoin.query.filter_by(tenant_id=tenant.id, account_id=account.id).first()
|
ta = TenantAccountJoin.query.filter_by(tenant_id=tenant.id, account_id=account.id).first()
|
||||||
if not ta:
|
if not ta:
|
||||||
raise MemberNotInTenantError("Member not in tenant.")
|
raise MemberNotInTenantError("Member not in tenant.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user