
* core: fix application API always being sorted by name * web: add sorting to tables * web: add search to TablePage * core: add search to applications API * core: add MetaNameSerializer * *: fix signature for non-modal serializers * providers/*: implement MetaNameSerializer * web: implement full app list page, use as default in sidebar * web: fix linting errors * admin: remove old application list * web: fix default sorting for application list * web: fix spacing for search element in toolbar
48 lines
1.7 KiB
Python
48 lines
1.7 KiB
Python
"""core Configs API"""
|
|
from django.db.models import Model
|
|
from drf_yasg2.utils import swagger_auto_schema
|
|
from rest_framework.permissions import AllowAny
|
|
from rest_framework.request import Request
|
|
from rest_framework.response import Response
|
|
from rest_framework.serializers import ReadOnlyField, Serializer
|
|
from rest_framework.viewsets import ViewSet
|
|
|
|
from authentik.lib.config import CONFIG
|
|
|
|
|
|
class ConfigSerializer(Serializer):
|
|
"""Serialize authentik Config into DRF Object"""
|
|
|
|
branding_logo = ReadOnlyField()
|
|
branding_title = ReadOnlyField()
|
|
|
|
error_reporting_enabled = ReadOnlyField()
|
|
error_reporting_environment = ReadOnlyField()
|
|
error_reporting_send_pii = ReadOnlyField()
|
|
|
|
def create(self, validated_data: dict) -> Model:
|
|
raise NotImplementedError
|
|
|
|
def update(self, instance: Model, validated_data: dict) -> Model:
|
|
raise NotImplementedError
|
|
|
|
|
|
class ConfigsViewSet(ViewSet):
|
|
"""Read-only view set that returns the current session's Configs"""
|
|
|
|
permission_classes = [AllowAny]
|
|
|
|
@swagger_auto_schema(responses={200: ConfigSerializer(many=True)})
|
|
def list(self, request: Request) -> Response:
|
|
"""Retrive public configuration options"""
|
|
config = ConfigSerializer(
|
|
{
|
|
"branding_logo": CONFIG.y("authentik.branding.logo"),
|
|
"branding_title": CONFIG.y("authentik.branding.title"),
|
|
"error_reporting_enabled": CONFIG.y("error_reporting.enabled"),
|
|
"error_reporting_environment": CONFIG.y("error_reporting.environment"),
|
|
"error_reporting_send_pii": CONFIG.y("error_reporting.send_pii"),
|
|
}
|
|
)
|
|
return Response(config.data)
|