From 4374bdedf6aab3550fd5fa3f2a80b8c2560308a3 Mon Sep 17 00:00:00 2001 From: Marc 'risson' Schmitt Date: Mon, 11 Dec 2023 13:37:14 +0100 Subject: [PATCH] review comments Signed-off-by: Marc 'risson' Schmitt --- authentik/api/v3/config.py | 10 +++++----- authentik/brands/middleware.py | 2 -- authentik/events/signals.py | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/authentik/api/v3/config.py b/authentik/api/v3/config.py index e7fd3f021..3137a1922 100644 --- a/authentik/api/v3/config.py +++ b/authentik/api/v3/config.py @@ -62,7 +62,7 @@ class ConfigView(APIView): permission_classes = [AllowAny] - def get_capabilities(self, request: Request) -> list[Capabilities]: + def get_capabilities(self) -> list[Capabilities]: """Get all capabilities this server instance supports""" caps = [] deb_test = settings.DEBUG or settings.TEST @@ -70,7 +70,7 @@ class ConfigView(APIView): caps.append(Capabilities.CAN_SAVE_MEDIA) if GEOIP_READER.enabled: caps.append(Capabilities.CAN_GEO_IP) - if request.tenant.impersonation: + if self.request.tenant.impersonation: caps.append(Capabilities.CAN_IMPERSONATE) if settings.DEBUG: # pragma: no cover caps.append(Capabilities.CAN_DEBUG) @@ -81,7 +81,7 @@ class ConfigView(APIView): caps.append(result) return caps - def get_config(self, request: Request) -> ConfigSerializer: + def get_config(self) -> ConfigSerializer: """Get Config""" return ConfigSerializer( { @@ -92,7 +92,7 @@ class ConfigView(APIView): "send_pii": CONFIG.get("error_reporting.send_pii"), "traces_sample_rate": float(CONFIG.get("error_reporting.sample_rate", 0.4)), }, - "capabilities": self.get_capabilities(request), + "capabilities": self.get_capabilities(), "cache_timeout": CONFIG.get_int("cache.timeout"), "cache_timeout_flows": CONFIG.get_int("cache.timeout_flows"), "cache_timeout_policies": CONFIG.get_int("cache.timeout_policies"), @@ -103,4 +103,4 @@ class ConfigView(APIView): @extend_schema(responses={200: ConfigSerializer(many=False)}) def get(self, request: Request) -> Response: """Retrieve public configuration options""" - return Response(self.get_config(request).data) + return Response(self.get_config().data) diff --git a/authentik/brands/middleware.py b/authentik/brands/middleware.py index 9026e311a..627711233 100644 --- a/authentik/brands/middleware.py +++ b/authentik/brands/middleware.py @@ -21,8 +21,6 @@ class BrandMiddleware: if not hasattr(request, "brand"): brand = get_brand_for_request(request) setattr(request, "brand", brand) - set_tag("authentik.brand_uuid", brand.brand_uuid.hex) - set_tag("authentik.brand_domain", brand.domain) locale = brand.default_locale if locale != "": activate(locale) diff --git a/authentik/events/signals.py b/authentik/events/signals.py index 4d66d7b52..5d15d1dc1 100644 --- a/authentik/events/signals.py +++ b/authentik/events/signals.py @@ -93,5 +93,5 @@ def event_post_save_notification(sender, instance: Event, **_): @receiver(pre_delete, sender=User) def event_user_pre_delete_cleanup(sender, instance: User, **_): """If gdpr_compliance is enabled, remove all the user's events""" - if get_current_tenant().avatars: + if get_current_tenant().gdpr_compliance: gdpr_cleanup.delay(instance.pk)