Skip to content

Commit

Permalink
Don't require login for some admin views.
Browse files Browse the repository at this point in the history
  • Loading branch information
amanning9 committed Oct 25, 2024
1 parent 45e4e1f commit 42e0a94
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions jasmin_services/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import datetime as dt

import django.contrib.auth.decorators
import django.db.models as dj_models
import django.utils.decorators
import django.utils.timezone
import drf_spectacular.utils
import jasmin_django_utils.api.viewsets
Expand All @@ -15,6 +17,9 @@
from . import filters, serializers


@django.utils.decorators.method_decorator(
django.contrib.auth.decorators.login_not_required, name="dispatch"
)
class ServicesViewSet(
jasmin_django_utils.api.viewsets.ActionSerializerMixin,
rf_viewsets.ReadOnlyModelViewSet,
Expand Down Expand Up @@ -43,6 +48,9 @@ class ServicesViewSet(
]
),
)
@django.utils.decorators.method_decorator(
django.contrib.auth.decorators.login_not_required, name="dispatch"
)
class RolesNestedUnderServicesViewSet(rf_viewsets.ReadOnlyModelViewSet):
"""View roles for a service."""

Expand Down Expand Up @@ -119,6 +127,9 @@ def get_queryset(self):
]
),
)
@django.utils.decorators.method_decorator(
django.contrib.auth.decorators.login_not_required, name="dispatch"
)
class ServicesNestedUnderCategoriesViewSet(ServicesViewSet):
"""Viewset to allow services to be nested under categories.
Expand Down Expand Up @@ -153,6 +164,9 @@ def get_queryset(self):
],
)
)
@django.utils.decorators.method_decorator(
django.contrib.auth.decorators.login_not_required, name="dispatch"
)
class UserServicesViewSet(rf_mixins.ListModelMixin, rf_viewsets.GenericViewSet):
"""Get the services assocated with a user."""

Expand Down Expand Up @@ -202,6 +216,9 @@ def get_queryset(self):
]
),
)
@django.utils.decorators.method_decorator(
django.contrib.auth.decorators.login_not_required, name="dispatch"
)
class UserGrantsViewSet(rf_mixins.ListModelMixin, rf_viewsets.GenericViewSet):
"""Get the grants associated with a user."""

Expand All @@ -223,6 +240,9 @@ def get_queryset(self):
return queryset


@django.utils.decorators.method_decorator(
django.contrib.auth.decorators.login_not_required, name="dispatch"
)
class CategoriesViewSet(
jasmin_django_utils.api.viewsets.ActionSerializerMixin,
rf_viewsets.ReadOnlyModelViewSet,
Expand Down

0 comments on commit 42e0a94

Please sign in to comment.