Open source video conferencing app powered by LiveKit. Built with Django and React.
π₯(backend) remove unused API viewset and permission helpers
Lebaud Antoine9a2ad63524f6
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 33064a63..8a7ec500 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,7 @@ and this project adheres to### Changed+- π₯(backend) remove unused API viewset and permission helpers- π(backend) pin the dockerflow logger level to WARNING- ποΈ(summary) serve health endpoints with the dockerflow router- β»οΈ(backend) serve the dockerflow views early in the middleware stackdiff --git a/src/backend/core/api/permissions.py b/src/backend/core/api/permissions.pyindex 3992be0d..1fb44fa8 100644--- a/src/backend/core/api/permissions.py+++ b/src/backend/core/api/permissions.py@@ -12,10 +12,6 @@ from ..services.participants_management import (ParticipantsManagementException,)-ACTION_FOR_METHOD_TO_PERMISSION = {- "versions_detail": {"DELETE": "versions_destroy", "GET": "versions_retrieve"}-}-class IsAuthenticated(permissions.BasePermission):"""@@ -27,15 +23,6 @@ class IsAuthenticated(permissions.BasePermission):return bool(request.auth) or request.user.is_authenticated-class IsAuthenticatedOrSafe(IsAuthenticated):- """Allows access to authenticated users (or anonymous users but only on safe methods)."""-- def has_permission(self, request, view):- if request.method in permissions.SAFE_METHODS:- return True- return super().has_permission(request, view)--class IsSelf(IsAuthenticated):"""Allows access only to authenticated users. Alternative method checking the presencediff --git a/src/backend/core/api/viewsets.py b/src/backend/core/api/viewsets.pyindex 0a4ab1d6..91c8d329 100644--- a/src/backend/core/api/viewsets.py+++ b/src/backend/core/api/viewsets.py@@ -95,60 +95,6 @@ from .feature_flag import FeatureFlaglogger = getLogger(__name__)-class NestedGenericViewSet(viewsets.GenericViewSet):- """- A generic Viewset aims to be used in a nested route context.- e.g: `/api/v1.0/resource_1/<resource_1_pk>/resource_2/<resource_2_pk>/`-- It allows to define all url kwargs and lookup fields to perform the lookup.- """-- lookup_fields: list[str] = ["pk"]- lookup_url_kwargs: list[str] = []-- def __getattribute__(self, file):- """- This method is overridden to allow to get the last lookup field or lookup url kwarg- when accessing the `lookup_field` or `lookup_url_kwarg` attribute. This is useful- to keep compatibility with all methods used by the parent class `GenericViewSet`.- """- if file in ["lookup_field", "lookup_url_kwarg"]:- return getattr(self, file + "s", [None])[-1]-- return super().__getattribute__(file)-- def get_queryset(self):- """- Get the list of files for this view.-- `lookup_fields` attribute is enumerated here to perform the nested lookup.- """- queryset = super().get_queryset()-- # The last lookup field is removed to perform the nested lookup as it corresponds- # to the object pk, it is used within get_object method.- lookup_url_kwargs = (- self.lookup_url_kwargs[:-1]- if self.lookup_url_kwargs- else self.lookup_fields[:-1]- )-- filter_kwargs = {}- for index, lookup_url_kwarg in enumerate(lookup_url_kwargs):- if lookup_url_kwarg not in self.kwargs:- raise KeyError(- f"Expected view {self.__class__.__name__} to be called with a URL "- f'keyword argument named "{lookup_url_kwarg}". Fix your URL conf, or '- "set the `.lookup_fields` attribute on the view correctly."- )-- filter_kwargs.update(- {self.lookup_fields[index]: self.kwargs[lookup_url_kwarg]}- )-- return queryset.filter(**filter_kwargs)--class SerializerPerActionMixin:"""A mixin to allow to define serializer classes for each action.