mirror of https://github.com/jumpserver/jumpserver
parent
9492518773
commit
42ebb1f82f
|
@ -27,9 +27,11 @@ class RoleViewSet(JMSModelViewSet):
|
||||||
}
|
}
|
||||||
|
|
||||||
def perform_destroy(self, instance):
|
def perform_destroy(self, instance):
|
||||||
|
from orgs.utils import tmp_to_root_org
|
||||||
if instance.builtin:
|
if instance.builtin:
|
||||||
error = _("Internal role, can't be destroy")
|
error = _("Internal role, can't be destroy")
|
||||||
raise PermissionDenied(error)
|
raise PermissionDenied(error)
|
||||||
|
with tmp_to_root_org():
|
||||||
if instance.users.count() >= 1:
|
if instance.users.count() >= 1:
|
||||||
error = _("The role has been bound to users, can't be destroy")
|
error = _("The role has been bound to users, can't be destroy")
|
||||||
raise PermissionDenied(error)
|
raise PermissionDenied(error)
|
||||||
|
|
Loading…
Reference in New Issue