review comments
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
parent
443dcc8ac6
commit
4374bdedf6
|
@ -62,7 +62,7 @@ class ConfigView(APIView):
|
||||||
|
|
||||||
permission_classes = [AllowAny]
|
permission_classes = [AllowAny]
|
||||||
|
|
||||||
def get_capabilities(self, request: Request) -> list[Capabilities]:
|
def get_capabilities(self) -> list[Capabilities]:
|
||||||
"""Get all capabilities this server instance supports"""
|
"""Get all capabilities this server instance supports"""
|
||||||
caps = []
|
caps = []
|
||||||
deb_test = settings.DEBUG or settings.TEST
|
deb_test = settings.DEBUG or settings.TEST
|
||||||
|
@ -70,7 +70,7 @@ class ConfigView(APIView):
|
||||||
caps.append(Capabilities.CAN_SAVE_MEDIA)
|
caps.append(Capabilities.CAN_SAVE_MEDIA)
|
||||||
if GEOIP_READER.enabled:
|
if GEOIP_READER.enabled:
|
||||||
caps.append(Capabilities.CAN_GEO_IP)
|
caps.append(Capabilities.CAN_GEO_IP)
|
||||||
if request.tenant.impersonation:
|
if self.request.tenant.impersonation:
|
||||||
caps.append(Capabilities.CAN_IMPERSONATE)
|
caps.append(Capabilities.CAN_IMPERSONATE)
|
||||||
if settings.DEBUG: # pragma: no cover
|
if settings.DEBUG: # pragma: no cover
|
||||||
caps.append(Capabilities.CAN_DEBUG)
|
caps.append(Capabilities.CAN_DEBUG)
|
||||||
|
@ -81,7 +81,7 @@ class ConfigView(APIView):
|
||||||
caps.append(result)
|
caps.append(result)
|
||||||
return caps
|
return caps
|
||||||
|
|
||||||
def get_config(self, request: Request) -> ConfigSerializer:
|
def get_config(self) -> ConfigSerializer:
|
||||||
"""Get Config"""
|
"""Get Config"""
|
||||||
return ConfigSerializer(
|
return ConfigSerializer(
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@ class ConfigView(APIView):
|
||||||
"send_pii": CONFIG.get("error_reporting.send_pii"),
|
"send_pii": CONFIG.get("error_reporting.send_pii"),
|
||||||
"traces_sample_rate": float(CONFIG.get("error_reporting.sample_rate", 0.4)),
|
"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": CONFIG.get_int("cache.timeout"),
|
||||||
"cache_timeout_flows": CONFIG.get_int("cache.timeout_flows"),
|
"cache_timeout_flows": CONFIG.get_int("cache.timeout_flows"),
|
||||||
"cache_timeout_policies": CONFIG.get_int("cache.timeout_policies"),
|
"cache_timeout_policies": CONFIG.get_int("cache.timeout_policies"),
|
||||||
|
@ -103,4 +103,4 @@ class ConfigView(APIView):
|
||||||
@extend_schema(responses={200: ConfigSerializer(many=False)})
|
@extend_schema(responses={200: ConfigSerializer(many=False)})
|
||||||
def get(self, request: Request) -> Response:
|
def get(self, request: Request) -> Response:
|
||||||
"""Retrieve public configuration options"""
|
"""Retrieve public configuration options"""
|
||||||
return Response(self.get_config(request).data)
|
return Response(self.get_config().data)
|
||||||
|
|
|
@ -21,8 +21,6 @@ class BrandMiddleware:
|
||||||
if not hasattr(request, "brand"):
|
if not hasattr(request, "brand"):
|
||||||
brand = get_brand_for_request(request)
|
brand = get_brand_for_request(request)
|
||||||
setattr(request, "brand", brand)
|
setattr(request, "brand", brand)
|
||||||
set_tag("authentik.brand_uuid", brand.brand_uuid.hex)
|
|
||||||
set_tag("authentik.brand_domain", brand.domain)
|
|
||||||
locale = brand.default_locale
|
locale = brand.default_locale
|
||||||
if locale != "":
|
if locale != "":
|
||||||
activate(locale)
|
activate(locale)
|
||||||
|
|
|
@ -93,5 +93,5 @@ def event_post_save_notification(sender, instance: Event, **_):
|
||||||
@receiver(pre_delete, sender=User)
|
@receiver(pre_delete, sender=User)
|
||||||
def event_user_pre_delete_cleanup(sender, instance: User, **_):
|
def event_user_pre_delete_cleanup(sender, instance: User, **_):
|
||||||
"""If gdpr_compliance is enabled, remove all the user's events"""
|
"""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)
|
gdpr_cleanup.delay(instance.pk)
|
||||||
|
|
Reference in New Issue