mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
restrict metrics to superuser and system auditor
This commit is contained in:
parent
fc9da002d2
commit
1abb0b2c35
@ -10,6 +10,8 @@ from django.utils.translation import ugettext_lazy as _
|
||||
# Django REST Framework
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.renderers import JSONRenderer
|
||||
from rest_framework.exceptions import PermissionDenied
|
||||
|
||||
|
||||
# AWX
|
||||
# from awx.main.analytics import collectors
|
||||
@ -35,4 +37,6 @@ class MetricsView(APIView):
|
||||
|
||||
def get(self, request, format='txt'):
|
||||
''' Show Metrics Details '''
|
||||
return Response(metrics().decode('UTF-8'))
|
||||
if (request.user.is_superuser or request.user.is_system_auditor):
|
||||
return Response(metrics().decode('UTF-8'))
|
||||
raise PermissionDenied()
|
||||
|
Loading…
Reference in New Issue
Block a user