From 32fb90e056b8d2668cfebc0cbf181be033a921a5 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 27 Mar 2021 15:53:54 +0100 Subject: [PATCH] core: include full users in group API Signed-off-by: Jens Langhammer --- authentik/core/api/groups.py | 4 ++ swagger.yaml | 117 ++++++++++++++++++++++++----------- 2 files changed, 86 insertions(+), 35 deletions(-) diff --git a/authentik/core/api/groups.py b/authentik/core/api/groups.py index 2ca259fb4..801d5e618 100644 --- a/authentik/core/api/groups.py +++ b/authentik/core/api/groups.py @@ -2,16 +2,20 @@ from rest_framework.serializers import ModelSerializer from rest_framework.viewsets import ModelViewSet +from authentik.core.api.users import UserSerializer from authentik.core.models import Group class GroupSerializer(ModelSerializer): """Group Serializer""" + users = UserSerializer(many=True) + class Meta: model = Group fields = ["pk", "name", "is_superuser", "parent", "users", "attributes"] + depth = 2 class GroupViewSet(ModelViewSet): diff --git a/swagger.yaml b/swagger.yaml index da9fcb68f..876f360ca 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -10934,42 +10934,7 @@ definitions: format: uuid readOnly: true uniqueItems: true - Group: - description: Group Serializer - required: - - name - - parent - - users - type: object - properties: - pk: - 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 - parent: - title: Parent - type: string - format: uuid - users: - type: array - items: - type: integer - uniqueItems: true - attributes: - title: Attributes - type: object User: - title: User description: User Serializer required: - username @@ -11020,6 +10985,88 @@ definitions: attributes: title: Attributes type: object + Group: + description: Group Serializer + required: + - name + - users + type: object + properties: + pk: + 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 + parent: + 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 + users: + description: '' + type: array + items: + $ref: '#/definitions/User' + attributes: + title: Attributes + type: object Token: description: Token Serializer required: