review comments

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt 2023-12-11 13:37:14 +01:00
parent 443dcc8ac6
commit 4374bdedf6
No known key found for this signature in database
GPG Key ID: 9C3FA22FABF1AA8D
3 changed files with 6 additions and 8 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)