mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
add customer API doc fixes:#1390
This commit is contained in:
parent
75a69d7c83
commit
554d8ed8a6
@ -177,3 +177,10 @@ class Metadata(metadata.SimpleMetadata):
|
||||
metadata['search_fields'] = view.search_fields
|
||||
|
||||
return metadata
|
||||
|
||||
class RoleMetadata(Metadata):
|
||||
def determine_metadata(self, request, view):
|
||||
metadata = super(RoleMetadata, self).determine_metadata(request, view)
|
||||
if 'actions' in metadata:
|
||||
metadata['actions'].pop('POST')
|
||||
return metadata
|
||||
|
@ -1446,7 +1446,8 @@ class RoleSerializer(BaseSerializer):
|
||||
|
||||
class Meta:
|
||||
model = Role
|
||||
fields = ('*',)
|
||||
fields = ('*', 'description', 'name')
|
||||
read_only_fields = ('description', 'name')
|
||||
|
||||
def get_related(self, obj):
|
||||
ret = super(RoleSerializer, self).get_related(obj)
|
||||
|
@ -67,6 +67,7 @@ from awx.main.utils import * # noqa
|
||||
from awx.api.permissions import * # noqa
|
||||
from awx.api.renderers import * # noqa
|
||||
from awx.api.serializers import * # noqa
|
||||
from awx.api.metadata import RoleMetadata
|
||||
from awx.main.utils import emit_websocket_notification
|
||||
from awx.main.conf import tower_settings
|
||||
|
||||
@ -795,6 +796,7 @@ class TeamRolesList(SubListCreateAttachDetachAPIView):
|
||||
|
||||
model = Role
|
||||
serializer_class = RoleSerializer
|
||||
metadata_class = RoleMetadata
|
||||
parent_model = Team
|
||||
relationship='member_role.children'
|
||||
|
||||
@ -1075,6 +1077,7 @@ class UserRolesList(SubListCreateAttachDetachAPIView):
|
||||
|
||||
model = Role
|
||||
serializer_class = RoleSerializer
|
||||
metadata_class = RoleMetadata
|
||||
parent_model = User
|
||||
relationship='roles'
|
||||
permission_classes = (IsAuthenticated,)
|
||||
|
Loading…
Reference in New Issue
Block a user