mirror of
https://github.com/ansible/awx.git
synced 2026-03-22 03:17:39 -02:30
Check license before launching job template and disallow scan job
template launch if license is unsupported
This commit is contained in:
@@ -1708,6 +1708,7 @@ class JobTemplateLaunch(RetrieveAPIView, GenericAPIView):
|
|||||||
model = JobTemplate
|
model = JobTemplate
|
||||||
serializer_class = JobLaunchSerializer
|
serializer_class = JobLaunchSerializer
|
||||||
is_job_start = True
|
is_job_start = True
|
||||||
|
always_allow_superuser = False
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
obj = self.get_object()
|
obj = self.get_object()
|
||||||
|
|||||||
@@ -997,7 +997,11 @@ class JobTemplateAccess(BaseAccess):
|
|||||||
def can_start(self, obj, validate_license=True):
|
def can_start(self, obj, validate_license=True):
|
||||||
# Check license.
|
# Check license.
|
||||||
if validate_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
|
# Super users can start any job
|
||||||
if self.user.is_superuser:
|
if self.user.is_superuser:
|
||||||
|
|||||||
Reference in New Issue
Block a user