Check survey license enabled when creating, updating, and starting job

templates with surveys enabled
This commit is contained in:
Matthew Jones
2015-06-01 17:01:28 -04:00
parent 72c12054c1
commit 7d8edd9617
3 changed files with 29 additions and 4 deletions

View File

@@ -925,6 +925,9 @@ class JobTemplateAccess(BaseAccess):
if 'job_type' in data and data['job_type'] == PERM_INVENTORY_SCAN:
self.check_license(feature='system_tracking')
if 'survey_enabled' in data and data['survey_enabled']:
self.check_license(feature='surveys')
if self.user.is_superuser:
return True
@@ -997,11 +1000,11 @@ class JobTemplateAccess(BaseAccess):
def can_start(self, obj, validate_license=True):
# Check license.
if validate_license:
k = {}
self.check_license()
if obj.job_type == PERM_INVENTORY_SCAN:
print("In perm inv scan test")
k = dict(feature='system_tracking')
self.check_license(**k)
self.check_license(feature='system_tracking')
if obj.survey_enabled:
self.check_license(feature='surveys')
# Super users can start any job
if self.user.is_superuser: