mirror of https://github.com/jumpserver/jumpserver
fix(users): 组织管理员创建用户时,角色只能选择: 用户
parent
0014bd0cb9
commit
bb60d2a1d9
|
@ -87,7 +87,11 @@ class UserSerializer(CommonBulkSerializerMixin, serializers.ModelSerializer):
|
||||||
if not role:
|
if not role:
|
||||||
return
|
return
|
||||||
choices = role._choices
|
choices = role._choices
|
||||||
choices.pop('App', None)
|
choices.pop(User.ROLE_APP, None)
|
||||||
|
request = self.context.get('request')
|
||||||
|
if request and hasattr(request, 'user') and not request.user.is_superuser:
|
||||||
|
choices.pop(User.ROLE_ADMIN, None)
|
||||||
|
choices.pop(User.ROLE_AUDITOR, None)
|
||||||
role._choices = choices
|
role._choices = choices
|
||||||
|
|
||||||
def validate_role(self, value):
|
def validate_role(self, value):
|
||||||
|
|
Loading…
Reference in New Issue