mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 11:11:07 -03:30
restrict metrics to superuser and system auditor
This commit is contained in:
@@ -10,6 +10,8 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
# Django REST Framework
|
# Django REST Framework
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.renderers import JSONRenderer
|
from rest_framework.renderers import JSONRenderer
|
||||||
|
from rest_framework.exceptions import PermissionDenied
|
||||||
|
|
||||||
|
|
||||||
# AWX
|
# AWX
|
||||||
# from awx.main.analytics import collectors
|
# from awx.main.analytics import collectors
|
||||||
@@ -35,4 +37,6 @@ class MetricsView(APIView):
|
|||||||
|
|
||||||
def get(self, request, format='txt'):
|
def get(self, request, format='txt'):
|
||||||
''' Show Metrics Details '''
|
''' 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()
|
||||||
|
|||||||
Reference in New Issue
Block a user