This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/flows/api.py
2020-05-08 18:29:18 +02:00

52 lines
1.1 KiB
Python

"""Flow API Views"""
from rest_framework.serializers import ModelSerializer
from rest_framework.viewsets import ModelViewSet
from passbook.flows.models import Flow, FlowFactorBinding
class FlowSerializer(ModelSerializer):
"""Flow Serializer"""
class Meta:
model = Flow
fields = [
"pk",
"name",
"slug",
"designation",
"factors",
"policies"
]
class FlowViewSet(ModelViewSet):
"""Flow Viewset"""
queryset = Flow.objects.all()
serializer_class = FlowSerializer
class FlowFactorBindingSerializer(ModelSerializer):
"""FlowFactorBinding Serializer"""
class Meta:
model = FlowFactorBinding
fields = [
"pk",
"flow",
"factor",
"re_evaluate_policies",
"order",
"policies"
]
class FlowFactorBindingViewSet(ModelViewSet):
"""FlowFactorBinding Viewset"""
queryset = FlowFactorBinding.objects.all()
serializer_class = FlowFactorBindingSerializer