mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 19:07:36 -02:30
Turn off permissions check bypassing for admins when hitting the execution environment list and detail views.
This commit is contained in:
committed by
Shane McDonald
parent
5b2adc89cf
commit
b417fc3803
@@ -688,6 +688,7 @@ class TeamAccessList(ResourceAccessList):
|
|||||||
|
|
||||||
class ExecutionEnvironmentList(ListCreateAPIView):
|
class ExecutionEnvironmentList(ListCreateAPIView):
|
||||||
|
|
||||||
|
always_allow_superuser = False
|
||||||
model = models.ExecutionEnvironment
|
model = models.ExecutionEnvironment
|
||||||
serializer_class = serializers.ExecutionEnvironmentSerializer
|
serializer_class = serializers.ExecutionEnvironmentSerializer
|
||||||
swagger_topic = "Execution Environments"
|
swagger_topic = "Execution Environments"
|
||||||
@@ -695,6 +696,7 @@ class ExecutionEnvironmentList(ListCreateAPIView):
|
|||||||
|
|
||||||
class ExecutionEnvironmentDetail(RetrieveUpdateDestroyAPIView):
|
class ExecutionEnvironmentDetail(RetrieveUpdateDestroyAPIView):
|
||||||
|
|
||||||
|
always_allow_superuser = False
|
||||||
model = models.ExecutionEnvironment
|
model = models.ExecutionEnvironment
|
||||||
serializer_class = serializers.ExecutionEnvironmentSerializer
|
serializer_class = serializers.ExecutionEnvironmentSerializer
|
||||||
swagger_topic = "Execution Environments"
|
swagger_topic = "Execution Environments"
|
||||||
|
|||||||
@@ -1329,13 +1329,10 @@ class ExecutionEnvironmentAccess(BaseAccess):
|
|||||||
Q(organization__isnull=True)
|
Q(organization__isnull=True)
|
||||||
).distinct()
|
).distinct()
|
||||||
|
|
||||||
|
@check_superuser
|
||||||
def can_add(self, data):
|
def can_add(self, data):
|
||||||
if not data: # So the browseable API will work
|
if not data: # So the browseable API will work
|
||||||
return Organization.accessible_objects(self.user, 'execution_environment_admin_role').exists()
|
return Organization.accessible_objects(self.user, 'execution_environment_admin_role').exists()
|
||||||
if obj.managed_by_tower:
|
|
||||||
raise PermissionDenied
|
|
||||||
if self.user.is_superuser:
|
|
||||||
return True
|
|
||||||
return self.check_related('organization', Organization, data, mandatory=True,
|
return self.check_related('organization', Organization, data, mandatory=True,
|
||||||
role_field='execution_environment_admin_role')
|
role_field='execution_environment_admin_role')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user