2022-06-03 08:09:47 -06:00
|
|
|
from rest_framework.permissions import IsAuthenticated
|
|
|
|
|
from rest_framework.response import Response
|
|
|
|
|
from rest_framework.views import APIView
|
|
|
|
|
|
2024-10-30 06:54:55 -03:00
|
|
|
from apps.api.permissions import RBACPermission
|
2022-06-03 08:09:47 -06:00
|
|
|
from apps.auth_token.auth import ApiTokenAuthentication
|
2022-06-08 18:25:58 +04:00
|
|
|
from apps.public_api.throttlers import InfoThrottler
|
2022-06-03 08:09:47 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class InfoView(APIView):
|
|
|
|
|
authentication_classes = (ApiTokenAuthentication,)
|
2024-10-30 06:54:55 -03:00
|
|
|
permission_classes = (IsAuthenticated, RBACPermission)
|
|
|
|
|
|
|
|
|
|
rbac_permissions = {
|
|
|
|
|
"get": [RBACPermission.Permissions.OTHER_SETTINGS_READ],
|
|
|
|
|
}
|
2022-06-03 08:09:47 -06:00
|
|
|
|
2022-06-08 18:25:58 +04:00
|
|
|
throttle_classes = [InfoThrottler]
|
2022-06-03 08:09:47 -06:00
|
|
|
|
|
|
|
|
def get(self, request):
|
|
|
|
|
response = {"url": self.request.auth.organization.grafana_url}
|
|
|
|
|
return Response(response)
|