mirror of
https://github.com/ansible/awx.git
synced 2026-02-27 07:56:06 -03:30
Merge pull request #3652 from jangsutsr/3484_add_license_validation_to_job_add
Add validate_license to job's can_add
This commit is contained in:
@@ -1194,7 +1194,10 @@ class JobAccess(BaseAccess):
|
|||||||
return True
|
return True
|
||||||
return self.org_access(obj, role_types=['auditor_role', 'admin_role'])
|
return self.org_access(obj, role_types=['auditor_role', 'admin_role'])
|
||||||
|
|
||||||
def can_add(self, data):
|
def can_add(self, data, validate_license=True):
|
||||||
|
if validate_license:
|
||||||
|
self.check_license()
|
||||||
|
|
||||||
if not data: # So the browseable API will work
|
if not data: # So the browseable API will work
|
||||||
return True
|
return True
|
||||||
if not self.user.is_superuser:
|
if not self.user.is_superuser:
|
||||||
@@ -1218,7 +1221,9 @@ class JobAccess(BaseAccess):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def can_change(self, obj, data):
|
def can_change(self, obj, data):
|
||||||
return obj.status == 'new' and self.can_read(obj) and self.can_add(data)
|
return (obj.status == 'new' and
|
||||||
|
self.can_read(obj) and
|
||||||
|
self.can_add(data, validate_license=False))
|
||||||
|
|
||||||
@check_superuser
|
@check_superuser
|
||||||
def can_delete(self, obj):
|
def can_delete(self, obj):
|
||||||
|
|||||||
Reference in New Issue
Block a user