mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-06 18:00:57 +00:00
perf: 优化组织管理员不能更新系统管理员
This commit is contained in:
@@ -17,11 +17,7 @@ class UserObjectPermission(permissions.BasePermission):
|
||||
if view.action not in ['update', 'partial_update', 'destroy']:
|
||||
return True
|
||||
|
||||
user = request.user
|
||||
if user.is_superuser:
|
||||
return True
|
||||
if not request.user.is_superuser and obj.is_superuser:
|
||||
return False
|
||||
|
||||
system_admin_id = BuiltinRole.system_admin.id
|
||||
return system_admin_id not in [
|
||||
str(r.id) for r in obj.system_roles.all()
|
||||
]
|
||||
return True
|
||||
|
Reference in New Issue
Block a user