mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
Revert ScheduleAccess can_* methods to route through other *Access classes
This takes care of all the polymorphic cases, which we'd have to otherwise handle
This commit is contained in:
parent
c0245317b3
commit
3ca016faaf
@ -1142,7 +1142,8 @@ class ScheduleAccess(BaseAccess):
|
|||||||
if self.user.is_superuser:
|
if self.user.is_superuser:
|
||||||
return True
|
return True
|
||||||
if obj and obj.unified_job_template:
|
if obj and obj.unified_job_template:
|
||||||
return obj.unified_job_template.accessible_by(self.user, {'read':True})
|
job_class = obj.unified_job_template
|
||||||
|
return self.user.can_access(type(job_class), 'read', obj.unified_job_template)
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -1152,7 +1153,7 @@ class ScheduleAccess(BaseAccess):
|
|||||||
pk = get_pk_from_dict(data, 'unified_job_template')
|
pk = get_pk_from_dict(data, 'unified_job_template')
|
||||||
obj = get_object_or_400(UnifiedJobTemplate, pk=pk)
|
obj = get_object_or_400(UnifiedJobTemplate, pk=pk)
|
||||||
if obj:
|
if obj:
|
||||||
return obj.accessible_by(self.user, {'read':True, 'update':True, 'write':True})
|
return self.user.can_access(type(obj), 'change', obj, None)
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -1160,7 +1161,8 @@ class ScheduleAccess(BaseAccess):
|
|||||||
if self.user.is_superuser:
|
if self.user.is_superuser:
|
||||||
return True
|
return True
|
||||||
if obj and obj.unified_job_template:
|
if obj and obj.unified_job_template:
|
||||||
return obj.unified_job_template.accessible_by(self.user, {'read':True, 'update':True, 'write':True})
|
job_class = obj.unified_job_template
|
||||||
|
return self.user.can_access(type(job_class), 'change', job_class, None)
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -1168,7 +1170,8 @@ class ScheduleAccess(BaseAccess):
|
|||||||
if self.user.is_superuser:
|
if self.user.is_superuser:
|
||||||
return True
|
return True
|
||||||
if obj and obj.unified_job_template:
|
if obj and obj.unified_job_template:
|
||||||
return obj.unified_job_template.accessible_by(self.user, {'read':True, 'update':True, 'write':True})
|
job_class = obj.unified_job_template
|
||||||
|
return self.user.can_access(type(job_class), 'change', job_class, None)
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user