mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 00:38:45 -03:30
Merge pull request #3172 from AlanCoding/3118_role_read
Drop in visible_roles to RoleAccess can_read
This commit is contained in:
@@ -3631,7 +3631,6 @@ class RoleDetail(RetrieveAPIView):
|
|||||||
|
|
||||||
model = Role
|
model = Role
|
||||||
serializer_class = RoleSerializer
|
serializer_class = RoleSerializer
|
||||||
permission_classes = (IsAuthenticated,)
|
|
||||||
new_in_300 = True
|
new_in_300 = True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1671,14 +1671,8 @@ class RoleAccess(BaseAccess):
|
|||||||
if self.user.is_superuser or self.user.is_system_auditor:
|
if self.user.is_superuser or self.user.is_system_auditor:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if obj.object_id:
|
return Role.filter_visible_roles(
|
||||||
sister_roles = Role.objects.filter(
|
self.user, Role.objects.filter(pk=obj.id)).exists()
|
||||||
content_type = obj.content_type,
|
|
||||||
object_id = obj.object_id
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
sister_roles = obj
|
|
||||||
return self.user.roles.filter(descendents__in=sister_roles).exists()
|
|
||||||
|
|
||||||
def can_add(self, obj, data):
|
def can_add(self, obj, data):
|
||||||
# Unsupported for now
|
# Unsupported for now
|
||||||
|
|||||||
Reference in New Issue
Block a user