mirror of
https://github.com/ansible/awx.git
synced 2026-03-17 00:47:29 -02:30
Fix up some serious issues posting new surveys and deleting them by
non-super users. Also fix up some issues checking can_change for job templates for operations like PATCH where not all of the data points will be submitted
This commit is contained in:
@@ -1493,6 +1493,7 @@ class JobTemplateSchedulesList(SubListCreateAPIView):
|
||||
class JobTemplateSurveySpec(GenericAPIView):
|
||||
|
||||
model = JobTemplate
|
||||
parent_model = JobTemplate
|
||||
# FIXME: Add serializer class to define fields in OPTIONS request!
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
@@ -1537,6 +1538,8 @@ class JobTemplateSurveySpec(GenericAPIView):
|
||||
|
||||
def delete(self, request, *args, **kwargs):
|
||||
obj = self.get_object()
|
||||
if not request.user.can_access(self.model, 'delete', obj):
|
||||
raise PermissionDenied()
|
||||
obj.survey_spec = {}
|
||||
obj.save()
|
||||
return Response()
|
||||
|
||||
Reference in New Issue
Block a user