policies: fix policybinding API returning wrong policy objects
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
b09943e106
commit
a31fc8319d
|
@ -15,6 +15,7 @@ authentik API Browser
|
||||||
spec-url="{{ path }}"
|
spec-url="{{ path }}"
|
||||||
heading-text="authentik"
|
heading-text="authentik"
|
||||||
theme="dark"
|
theme="dark"
|
||||||
|
render-style="view"
|
||||||
primary-color="#fd4b2d"
|
primary-color="#fd4b2d"
|
||||||
allow-spec-url-load="false"
|
allow-spec-url-load="false"
|
||||||
allow-spec-file-load="false">
|
allow-spec-file-load="false">
|
||||||
|
|
|
@ -102,8 +102,8 @@ class PolicyBindingViewSet(ModelViewSet):
|
||||||
"""PolicyBinding Viewset"""
|
"""PolicyBinding Viewset"""
|
||||||
|
|
||||||
queryset = PolicyBinding.objects.all().select_related(
|
queryset = PolicyBinding.objects.all().select_related(
|
||||||
"policy", "target", "group", "user"
|
"target", "group", "user"
|
||||||
)
|
).prefetch_related("policy") # prefetching policy so we resolve the subclass
|
||||||
serializer_class = PolicyBindingSerializer
|
serializer_class = PolicyBindingSerializer
|
||||||
filterset_fields = ["policy", "target", "enabled", "order", "timeout"]
|
filterset_fields = ["policy", "target", "enabled", "order", "timeout"]
|
||||||
search_fields = ["policy__name"]
|
search_fields = ["policy__name"]
|
||||||
|
|
Reference in New Issue