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.

feat: delete member delete rbac binding (#37904)

wangxiaolei9fc2925b00cf
diff --git a/api/services/account_service.py b/api/services/account_service.py
index 7ab757040bb..445b1acd3b9 100644
--- a/api/services/account_service.py
+++ b/api/services/account_service.py
@@ -1788,6 +1788,9 @@ class TenantService:
account_id,
)
+ if dify_config.RBAC_ENABLED:
+ RBACService.MemberRoles.delete_rbac_bindings(tenant_id=tenant.id, account_id=account_id)
+
@staticmethod
def update_member_role(
tenant: Tenant, member: Account, new_role: str, operator: Account, *, session: scoped_session | Session
diff --git a/api/services/enterprise/rbac_service.py b/api/services/enterprise/rbac_service.py
index af6f79948d7..1072c7051b0 100644
--- a/api/services/enterprise/rbac_service.py
+++ b/api/services/enterprise/rbac_service.py
@@ -1685,6 +1685,17 @@ class RBACService:
)
return MemberRolesResponse.model_validate(data or {})
+ @staticmethod
+ def delete_rbac_bindings(tenant_id: str, account_id: str):
+ data = _inner_call(
+ "DELETE",
+ f"{_INNER_PREFIX}/members/rbac-bindings",
+ tenant_id=tenant_id,
+ account_id=account_id,
+ params={"account_id": account_id},
+ )
+ return data
+
class CheckAccess:
"""Call the ``/inner/api/rbac/check-access`` endpoint."""