Skip to content

Commit

Permalink
chore: fixed linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
EwoutV committed Mar 5, 2024
1 parent f1c18b3 commit fe100d8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions backend/api/views/admin_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from authentication.serializers import UserSerializer
from authentication.models import User


class AdminViewSet(viewsets.ModelViewSet):
queryset = User.objects.filter(is_staff=True)
serializer_class = UserSerializer
2 changes: 1 addition & 1 deletion backend/authentication/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ def has_permission(self, request: Request, view: ViewSet):
"""Check whether a user has permission in the CAS flow context."""
return request.user.is_authenticated or view.action not in [
'logout', 'whoami'
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
FIRST_NAME = "Dummy"
LAST_NAME = "McDickwad"


class UserSerializerModelTests(TestCase):
def test_invalid_email_makes_user_serializer_invalid(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion backend/authentication/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from authentication.views import CASViewSet

router = DefaultRouter()
router.register(f"cas", CASViewSet,"cas")
router.register("cas", CASViewSet, "cas")

urlpatterns = [
# AUTH endpoints.
Expand Down
3 changes: 2 additions & 1 deletion backend/authentication/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from authentication.cas.client import client
from ypovoli import settings


class CASViewSet(ViewSet):
# The IsAuthenticated class is applied by default,
# but it's good to be verbose when it comes to security.
Expand Down Expand Up @@ -43,4 +44,4 @@ def who_am_i(self, request: Request) -> Response:
@action(detail=False, methods=['GET'], permission_classes=[AllowAny])
def echo(self, request: Request) -> Response:
"""Echo the obtained CAS token for development and testing."""
return Response(request.query_params.get('ticket'))
return Response(request.query_params.get('ticket'))

0 comments on commit fe100d8

Please sign in to comment.