mirror of
https://github.com/ansible/awx.git
synced 2026-01-18 05:01:19 -03:30
Turn off permissions check bypassing for admins when hitting the execution environment list and detail views.
This commit is contained in:
parent
5b2adc89cf
commit
b417fc3803
@ -688,6 +688,7 @@ class TeamAccessList(ResourceAccessList):
|
||||
|
||||
class ExecutionEnvironmentList(ListCreateAPIView):
|
||||
|
||||
always_allow_superuser = False
|
||||
model = models.ExecutionEnvironment
|
||||
serializer_class = serializers.ExecutionEnvironmentSerializer
|
||||
swagger_topic = "Execution Environments"
|
||||
@ -695,6 +696,7 @@ class ExecutionEnvironmentList(ListCreateAPIView):
|
||||
|
||||
class ExecutionEnvironmentDetail(RetrieveUpdateDestroyAPIView):
|
||||
|
||||
always_allow_superuser = False
|
||||
model = models.ExecutionEnvironment
|
||||
serializer_class = serializers.ExecutionEnvironmentSerializer
|
||||
swagger_topic = "Execution Environments"
|
||||
|
||||
@ -1329,13 +1329,10 @@ class ExecutionEnvironmentAccess(BaseAccess):
|
||||
Q(organization__isnull=True)
|
||||
).distinct()
|
||||
|
||||
@check_superuser
|
||||
def can_add(self, data):
|
||||
if not data: # So the browseable API will work
|
||||
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,
|
||||
role_field='execution_environment_admin_role')
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user