mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 15:27:47 -02:30
Merge pull request #3082 from anoek/3077
Fixed the need for elevated permissions to make changes to job templates under some scenarios
This commit is contained in:
@@ -906,8 +906,7 @@ class JobTemplateAccess(BaseAccess):
|
|||||||
project = get_value(Project, 'project')
|
project = get_value(Project, 'project')
|
||||||
if 'job_type' in data and data['job_type'] == PERM_INVENTORY_SCAN:
|
if 'job_type' in data and data['job_type'] == PERM_INVENTORY_SCAN:
|
||||||
if inventory:
|
if inventory:
|
||||||
org = inventory.organization
|
accessible = self.user in inventory.use_role
|
||||||
accessible = self.user in org.admin_role
|
|
||||||
else:
|
else:
|
||||||
accessible = False
|
accessible = False
|
||||||
if not project and accessible:
|
if not project and accessible:
|
||||||
@@ -979,7 +978,8 @@ class JobTemplateAccess(BaseAccess):
|
|||||||
|
|
||||||
for k, v in data.items():
|
for k, v in data.items():
|
||||||
if hasattr(obj, k) and getattr(obj, k) != v:
|
if hasattr(obj, k) and getattr(obj, k) != v:
|
||||||
if k not in field_whitelist and v != getattr(obj, '%s_id' % k, None):
|
if k not in field_whitelist and v != getattr(obj, '%s_id' % k, None) \
|
||||||
|
and not (hasattr(obj, '%s_id' % k) and getattr(obj, '%s_id' % k) is None and v == ''): # Equate '' to None in the case of foreign keys
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user