mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-07-05 11:06:34 +00:00
fix: 删除组织角色时 判断全局绑定用户数量 (#7774)
Co-authored-by: feng626 <1304903146@qq.com>
This commit is contained in:
parent
9492518773
commit
42ebb1f82f
@ -27,9 +27,11 @@ class RoleViewSet(JMSModelViewSet):
|
||||
}
|
||||
|
||||
def perform_destroy(self, instance):
|
||||
from orgs.utils import tmp_to_root_org
|
||||
if instance.builtin:
|
||||
error = _("Internal role, can't be destroy")
|
||||
raise PermissionDenied(error)
|
||||
with tmp_to_root_org():
|
||||
if instance.users.count() >= 1:
|
||||
error = _("The role has been bound to users, can't be destroy")
|
||||
raise PermissionDenied(error)
|
||||
|
Loading…
Reference in New Issue
Block a user