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.
2020-05-08 16:29:18 +00:00
|
|
|
"""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
|
2020-05-08 16:45:53 +00:00
|
|
|
fields = ["pk", "name", "slug", "designation", "factors", "policies"]
|
2020-05-08 16:29:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
class FlowViewSet(ModelViewSet):
|
|
|
|
"""Flow Viewset"""
|
|
|
|
|
|
|
|
queryset = Flow.objects.all()
|
|
|
|
serializer_class = FlowSerializer
|
|
|
|
|
|
|
|
|
|
|
|
class FlowFactorBindingSerializer(ModelSerializer):
|
|
|
|
"""FlowFactorBinding Serializer"""
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
|
|
|
model = FlowFactorBinding
|
2020-05-08 16:45:53 +00:00
|
|
|
fields = ["pk", "flow", "factor", "re_evaluate_policies", "order", "policies"]
|
2020-05-08 16:29:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
class FlowFactorBindingViewSet(ModelViewSet):
|
|
|
|
"""FlowFactorBinding Viewset"""
|
|
|
|
|
|
|
|
queryset = FlowFactorBinding.objects.all()
|
|
|
|
serializer_class = FlowFactorBindingSerializer
|