From 3cc7d54cc1fe4281c55ae07ca7a848e3941b3e02 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 29 Mar 2021 12:28:06 +0200 Subject: [PATCH] policies: use GroupSerializer for PolicyBinding API Signed-off-by: Jens Langhammer --- authentik/policies/api.py | 3 +++ swagger.yaml | 53 +-------------------------------------- 2 files changed, 4 insertions(+), 52 deletions(-) diff --git a/authentik/policies/api.py b/authentik/policies/api.py index 42ce8bc9f..d06740ab4 100644 --- a/authentik/policies/api.py +++ b/authentik/policies/api.py @@ -17,6 +17,7 @@ from rest_framework.viewsets import GenericViewSet, ModelViewSet from structlog.stdlib import get_logger from authentik.core.api.applications import user_app_cache_key +from authentik.core.api.groups import GroupSerializer from authentik.core.api.utils import ( CacheSerializer, MetaNameSerializer, @@ -176,6 +177,8 @@ class PolicyBindingSerializer(ModelSerializer): required=True, ) + group = GroupSerializer(required=False) + class Meta: model = PolicyBinding diff --git a/swagger.yaml b/swagger.yaml index da9fcb68f..264adfc9c 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -12216,58 +12216,7 @@ definitions: type: boolean readOnly: true group: - description: Custom Group model which supports a basic hierarchy - required: - - name - type: object - properties: - group_uuid: - title: Group uuid - type: string - format: uuid - readOnly: true - name: - title: Name - type: string - maxLength: 80 - minLength: 1 - is_superuser: - title: Is superuser - description: Users added to this group will be superusers. - type: boolean - attributes: - title: Attributes - type: object - parent: - description: Custom Group model which supports a basic hierarchy - required: - - name - - parent - type: object - properties: - group_uuid: - title: Group uuid - type: string - format: uuid - readOnly: true - name: - title: Name - type: string - maxLength: 80 - minLength: 1 - is_superuser: - title: Is superuser - description: Users added to this group will be superusers. - type: boolean - attributes: - title: Attributes - type: object - parent: - title: Parent - type: string - format: uuid - readOnly: true - readOnly: true + $ref: '#/definitions/Group' user: description: Custom User model to allow easier adding of user-based settings required: