Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix removing member without permission (#16332)

Linh Nguyen8996c1da296e
diff --git a/api/services/account_service.py b/api/services/account_service.py
index 42d1fba97f3..47730298b90 100644
--- a/api/services/account_service.py
+++ b/api/services/account_service.py
@@ -785,9 +785,11 @@ class TenantService:
@staticmethod
def remove_member_from_tenant(tenant: Tenant, account: Account, operator: Account) -> None:
"""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.")
+ TenantService.check_member_permission(tenant, operator, account, "remove")
+
ta = TenantAccountJoin.query.filter_by(tenant_id=tenant.id, account_id=account.id).first()
if not ta:
raise MemberNotInTenantError("Member not in tenant.")