mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 08:48:46 -03:30
update ACTIONS field of metadata.
This commit is contained in:
@@ -123,19 +123,20 @@ class Metadata(metadata.SimpleMetadata):
|
|||||||
actions = {}
|
actions = {}
|
||||||
for method in {'GET', 'PUT', 'POST'} & set(view.allowed_methods):
|
for method in {'GET', 'PUT', 'POST'} & set(view.allowed_methods):
|
||||||
view.request = clone_request(request, method)
|
view.request = clone_request(request, method)
|
||||||
|
obj = None
|
||||||
try:
|
try:
|
||||||
# Test global permissions
|
# Test global permissions
|
||||||
if hasattr(view, 'check_permissions'):
|
if hasattr(view, 'check_permissions'):
|
||||||
view.check_permissions(view.request)
|
view.check_permissions(view.request)
|
||||||
# Test object permissions
|
# Test object permissions
|
||||||
if method == 'PUT' and hasattr(view, 'get_object'):
|
if method == 'PUT' and hasattr(view, 'get_object'):
|
||||||
view.get_object()
|
obj = view.get_object()
|
||||||
except (exceptions.APIException, PermissionDenied, Http404):
|
except (exceptions.APIException, PermissionDenied, Http404):
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
# If user has appropriate permissions for the view, include
|
# If user has appropriate permissions for the view, include
|
||||||
# appropriate metadata about the fields that should be supplied.
|
# appropriate metadata about the fields that should be supplied.
|
||||||
serializer = view.get_serializer()
|
serializer = view.get_serializer(instance=obj)
|
||||||
actions[method] = self.get_serializer_info(serializer)
|
actions[method] = self.get_serializer_info(serializer)
|
||||||
finally:
|
finally:
|
||||||
view.request = request
|
view.request = request
|
||||||
|
|||||||
Reference in New Issue
Block a user