mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 20:00:43 -03:30
Fix 500 error when creating a job schedule
- 500 error occurs when a non-admin user attempts to add an invalid credential during schedule creation - This change checks that the user can add the object to serializer.validated_data, instead of serializer.initial_data - The invalid credential field is purged in .validated_data, so the request passes through cleanly - Fix for awx issue #4147
This commit is contained in:
parent
bda1abab8d
commit
58e84a40e5
@ -574,7 +574,7 @@ class SubListCreateAPIView(SubListAPIView, ListCreateAPIView):
|
||||
status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
# Verify we have permission to add the object as given.
|
||||
if not request.user.can_access(self.model, 'add', serializer.initial_data):
|
||||
if not request.user.can_access(self.model, 'add', serializer.validated_data):
|
||||
raise PermissionDenied()
|
||||
|
||||
# save the object through the serializer, reload and returned the saved
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user