mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 09:57:35 -02:30
Finish up the job template copying -> job_template/n/launch switch since
the UI implements this correctly now
This commit is contained in:
@@ -980,6 +980,8 @@ class JobAccess(BaseAccess):
|
|||||||
def can_add(self, data):
|
def can_add(self, data):
|
||||||
if not data or '_method' in data: # So the browseable API will work?
|
if not data or '_method' in data: # So the browseable API will work?
|
||||||
return True
|
return True
|
||||||
|
if not self.user.is_superuser:
|
||||||
|
return False
|
||||||
|
|
||||||
reader = TaskSerializer()
|
reader = TaskSerializer()
|
||||||
validation_info = reader.from_file()
|
validation_info = reader.from_file()
|
||||||
@@ -995,8 +997,6 @@ class JobAccess(BaseAccess):
|
|||||||
if validation_info.get('free_instances', 0) < 0:
|
if validation_info.get('free_instances', 0) < 0:
|
||||||
raise PermissionDenied("Host Count exceeds available instances")
|
raise PermissionDenied("Host Count exceeds available instances")
|
||||||
|
|
||||||
if self.user.is_superuser:
|
|
||||||
return True
|
|
||||||
add_data = dict(data.items())
|
add_data = dict(data.items())
|
||||||
|
|
||||||
# If a job template is provided, the user should have read access to it.
|
# If a job template is provided, the user should have read access to it.
|
||||||
@@ -1012,9 +1012,6 @@ class JobAccess(BaseAccess):
|
|||||||
add_data.setdefault('credential', job_template.credential.pk)
|
add_data.setdefault('credential', job_template.credential.pk)
|
||||||
else:
|
else:
|
||||||
job_template = None
|
job_template = None
|
||||||
# Only admins can create jobs without job templates
|
|
||||||
if not self.user.is_superuser:
|
|
||||||
return False
|
|
||||||
|
|
||||||
# Check that the user would be able to add a job template with the
|
# Check that the user would be able to add a job template with the
|
||||||
# same data.
|
# same data.
|
||||||
|
|||||||
Reference in New Issue
Block a user