mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
use get_object_or_400 to fetch Role
This commit is contained in:
parent
b127e74ae4
commit
9baa9594c7
@ -1210,7 +1210,7 @@ class UserRolesList(SubListCreateAttachDetachAPIView):
|
||||
if sub_id == self.request.user.admin_role.pk:
|
||||
raise PermissionDenied('You may not perform any action with your own admin_role.')
|
||||
|
||||
role = Role.objects.get(pk=sub_id)
|
||||
role = get_object_or_400(Role, pk=sub_id)
|
||||
user_content_type = ContentType.objects.get_for_model(User)
|
||||
if role.content_type == user_content_type:
|
||||
raise PermissionDenied('You may not change the membership of a users admin_role')
|
||||
|
Loading…
Reference in New Issue
Block a user