Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt 2023-12-20 11:20:14 +01:00
parent 9fd8cedbfa
commit eae9295184
No known key found for this signature in database
GPG Key ID: 9C3FA22FABF1AA8D
4 changed files with 7 additions and 5 deletions

View File

@ -4,7 +4,6 @@ from typing import Callable
from django.http.request import HttpRequest from django.http.request import HttpRequest
from django.http.response import HttpResponse from django.http.response import HttpResponse
from django.utils.translation import activate from django.utils.translation import activate
from sentry_sdk.api import set_tag
from authentik.brands.utils import get_brand_for_request from authentik.brands.utils import get_brand_for_request

View File

@ -1,13 +1,10 @@
"""Test brands""" """Test brands"""
from django.test.client import RequestFactory
from django.urls import reverse from django.urls import reverse
from rest_framework.test import APITestCase from rest_framework.test import APITestCase
from authentik.brands.api import Themes from authentik.brands.api import Themes
from authentik.brands.models import Brand from authentik.brands.models import Brand
from authentik.core.tests.utils import create_test_admin_user, create_test_brand from authentik.core.tests.utils import create_test_admin_user, create_test_brand
from authentik.events.models import Event, EventAction
from authentik.lib.utils.time import timedelta_from_string
class TestBrands(APITestCase): class TestBrands(APITestCase):

View File

@ -12,16 +12,21 @@ from authentik.lib.config import CONFIG
class FileStorage(FileSystemStorage): class FileStorage(FileSystemStorage):
"""File storage backend"""
# pylint: disable=invalid-overridden-method
@property @property
def base_location(self): def base_location(self):
return os.path.join( return os.path.join(
self._value_or_setting(self._location, settings.MEDIA_ROOT), connection.schema_name self._value_or_setting(self._location, settings.MEDIA_ROOT), connection.schema_name
) )
# pylint: disable=invalid-overridden-method
@property @property
def location(self): def location(self):
return os.path.abspath(self.base_location) return os.path.abspath(self.base_location)
# pylint: disable=invalid-overridden-method
@property @property
def base_url(self): def base_url(self):
if self._base_url is not None and not self._base_url.endswith("/"): if self._base_url is not None and not self._base_url.endswith("/"):
@ -71,6 +76,7 @@ class S3Storage(BaseS3Storage):
def _normalize_name(self, name): def _normalize_name(self, name):
try: try:
# pylint: disable=no-member
return safe_join(self.location, connection.schema_name, name) return safe_join(self.location, connection.schema_name, name)
except ValueError: except ValueError:
raise SuspiciousOperation("Attempted access to '%s' denied." % name) raise SuspiciousOperation("Attempted access to '%s' denied." % name)

View File

@ -6,7 +6,7 @@ from rest_framework import permissions
from rest_framework.authentication import get_authorization_header from rest_framework.authentication import get_authorization_header
from rest_framework.filters import OrderingFilter, SearchFilter from rest_framework.filters import OrderingFilter, SearchFilter
from rest_framework.generics import RetrieveUpdateAPIView from rest_framework.generics import RetrieveUpdateAPIView
from rest_framework.permissions import SAFE_METHODS, IsAdminUser from rest_framework.permissions import SAFE_METHODS
from rest_framework.request import Request from rest_framework.request import Request
from rest_framework.serializers import ModelSerializer from rest_framework.serializers import ModelSerializer
from rest_framework.views import View from rest_framework.views import View