From 16a9af08037c94e4b0015f7645837230bcf32ba7 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Wed, 21 Jan 2015 13:49:04 -0500 Subject: [PATCH] Fix an issue where non-org-admin users with appropriate job template permissions were not able to view or edit schedule details --- awx/main/access.py | 6 +++--- awx/main/tests/schedules.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/awx/main/access.py b/awx/main/access.py index f65bf4cdba..06e951d235 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -1318,8 +1318,8 @@ class ScheduleAccess(BaseAccess): if self.user.is_superuser: return True if obj and obj.unified_job_template: - job_class = obj.unified_job_template._get_unified_job_class() - return self.user.can_access(job_class, 'read', obj.unified_job_template) + job_class = obj.unified_job_template + return self.user.can_access(type(job_class), 'read', obj.unified_job_template) else: return False @@ -1338,7 +1338,7 @@ class ScheduleAccess(BaseAccess): return True if obj and obj.unified_job_template: job_class = obj.unified_job_template - return self.user.can_access(type(job_class), 'change', job_class, data) + return self.user.can_access(type(job_class), 'change', job_class, None) else: return False diff --git a/awx/main/tests/schedules.py b/awx/main/tests/schedules.py index 15c7440ceb..e980110c03 100644 --- a/awx/main/tests/schedules.py +++ b/awx/main/tests/schedules.py @@ -180,6 +180,7 @@ class ScheduleTest(BaseTest): with self.current_user(self.normal_django_user): data = self.put(new_schedule_url, data=data, expect=200) self.assertNotEqual(data['next_run'], None) + #TODO: Test path needed for non org-admin users, but rather regular users who have permission to create the JT associated with the Schedule def test_infinite_schedule(self): first_url = reverse('api:inventory_source_schedules_list', args=(self.first_inventory_source.pk,))