mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 22:16:00 -03:30
Merge branch 'devel' of https://github.com/ansible/ansible-tower into wf_rbac_prompt
This commit is contained in:
@@ -2275,6 +2275,7 @@ class JobTemplateLaunch(RetrieveAPIView, GenericAPIView):
|
||||
|
||||
new_job = obj.create_unified_job(**kv)
|
||||
result = new_job.signal_start(**kv)
|
||||
|
||||
if not result:
|
||||
data = dict(passwords_needed_to_start=new_job.passwords_needed_to_start)
|
||||
new_job.delete()
|
||||
@@ -2282,7 +2283,7 @@ class JobTemplateLaunch(RetrieveAPIView, GenericAPIView):
|
||||
else:
|
||||
data = OrderedDict()
|
||||
data['ignored_fields'] = ignored_fields
|
||||
data.update(JobSerializer(new_job).to_representation(new_job))
|
||||
data.update(JobSerializer(new_job, context=self.get_serializer_context()).to_representation(new_job))
|
||||
data['job'] = new_job.id
|
||||
return Response(data, status=status.HTTP_201_CREATED)
|
||||
|
||||
@@ -2968,7 +2969,7 @@ class JobRelaunch(RetrieveAPIView, GenericAPIView):
|
||||
data = dict(passwords_needed_to_start=new_job.passwords_needed_to_start)
|
||||
return Response(data, status=status.HTTP_400_BAD_REQUEST)
|
||||
else:
|
||||
data = JobSerializer(new_job).data
|
||||
data = JobSerializer(new_job, context=self.get_serializer_context()).data
|
||||
# Add job key to match what old relaunch returned.
|
||||
data['job'] = new_job.id
|
||||
headers = {'Location': new_job.get_absolute_url()}
|
||||
@@ -3426,7 +3427,7 @@ class AdHocCommandRelaunch(GenericAPIView):
|
||||
data = dict(passwords_needed_to_start=new_ad_hoc_command.passwords_needed_to_start)
|
||||
return Response(data, status=status.HTTP_400_BAD_REQUEST)
|
||||
else:
|
||||
data = AdHocCommandSerializer(new_ad_hoc_command).data
|
||||
data = AdHocCommandSerializer(new_ad_hoc_command, context=self.get_serializer_context()).data
|
||||
# Add ad_hoc_command key to match what was previously returned.
|
||||
data['ad_hoc_command'] = new_ad_hoc_command.id
|
||||
headers = {'Location': new_ad_hoc_command.get_absolute_url()}
|
||||
@@ -3762,7 +3763,16 @@ class RoleList(ListAPIView):
|
||||
new_in_300 = True
|
||||
|
||||
def get_queryset(self):
|
||||
return Role.visible_roles(self.request.user)
|
||||
result = Role.visible_roles(self.request.user)
|
||||
# Sanity check: is the requesting user an orphaned non-admin/auditor?
|
||||
# if yes, make system admin/auditor mandatorily visible.
|
||||
if not self.request.user.organizations.exists() and\
|
||||
not self.request.user.is_superuser and\
|
||||
not self.request.user.is_system_auditor:
|
||||
mandatories = ('system_administrator', 'system_auditor')
|
||||
super_qs = Role.objects.filter(singleton_name__in=mandatories)
|
||||
result = result | super_qs
|
||||
return result
|
||||
|
||||
|
||||
class RoleDetail(RetrieveAPIView):
|
||||
|
||||
Reference in New Issue
Block a user