From 06464333a60823ed0daec8ec514aa0edeccdf490 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 1 Jun 2015 14:15:42 -0400 Subject: [PATCH] Check license before launching job template and disallow scan job template launch if license is unsupported --- awx/api/views.py | 1 + awx/main/access.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/awx/api/views.py b/awx/api/views.py index 43af509d2d..6ec974d5fe 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -1708,6 +1708,7 @@ class JobTemplateLaunch(RetrieveAPIView, GenericAPIView): model = JobTemplate serializer_class = JobLaunchSerializer is_job_start = True + always_allow_superuser = False def post(self, request, *args, **kwargs): obj = self.get_object() diff --git a/awx/main/access.py b/awx/main/access.py index f3b9653b76..252a09c3a6 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -997,7 +997,11 @@ class JobTemplateAccess(BaseAccess): def can_start(self, obj, validate_license=True): # Check license. if validate_license: - self.check_license() + k = {} + if obj.job_type == PERM_INVENTORY_SCAN: + print("In perm inv scan test") + k = dict(feature='system_tracking') + self.check_license(**k) # Super users can start any job if self.user.is_superuser: