mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
Merge pull request #3404 from ryanpetrello/fix-missing-swagger-endpoints
generate Swagger schemas as if view permissions didn't matter Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
commit
22c4b28917
@ -13,6 +13,17 @@ from rest_framework.views import APIView
|
||||
from rest_framework_swagger import renderers
|
||||
|
||||
|
||||
class SuperUserSchemaGenerator(SchemaGenerator):
|
||||
|
||||
def has_view_permissions(self, path, method, view):
|
||||
#
|
||||
# Generate the Swagger schema as if you were a superuser and
|
||||
# permissions didn't matter; this short-circuits the schema path
|
||||
# discovery to include _all_ potential paths in the API.
|
||||
#
|
||||
return True
|
||||
|
||||
|
||||
class AutoSchema(DRFAuthSchema):
|
||||
|
||||
def get_link(self, path, method, base_url):
|
||||
@ -59,7 +70,7 @@ class SwaggerSchemaView(APIView):
|
||||
]
|
||||
|
||||
def get(self, request):
|
||||
generator = SchemaGenerator(
|
||||
generator = SuperUserSchemaGenerator(
|
||||
title='Ansible Tower API',
|
||||
patterns=None,
|
||||
urlconf=None
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user