Files
authentik/authentik/providers/saml/api/property_mappings.py
2024-07-26 19:14:27 +02:00

36 lines
1.1 KiB
Python

"""SAML Property mappings API Views"""
from rest_framework.viewsets import ModelViewSet
from authentik.core.api.property_mappings import PropertyMappingFilterSet, PropertyMappingSerializer
from authentik.core.api.used_by import UsedByMixin
from authentik.providers.saml.models import SAMLPropertyMapping
class SAMLPropertyMappingSerializer(PropertyMappingSerializer):
"""SAMLPropertyMapping Serializer"""
class Meta:
model = SAMLPropertyMapping
fields = PropertyMappingSerializer.Meta.fields + [
"saml_name",
"friendly_name",
]
class SAMLPropertyMappingFilter(PropertyMappingFilterSet):
"""Filter for SAMLPropertyMapping"""
class Meta(PropertyMappingFilterSet.Meta):
model = SAMLPropertyMapping
class SAMLPropertyMappingViewSet(UsedByMixin, ModelViewSet):
"""SAMLPropertyMapping Viewset"""
queryset = SAMLPropertyMapping.objects.all()
serializer_class = SAMLPropertyMappingSerializer
filterset_class = SAMLPropertyMappingFilter
search_fields = ["name"]
ordering = ["name"]