core: include full users in group API

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-03-27 15:53:54 +01:00
parent f636414fb7
commit 32fb90e056
2 changed files with 86 additions and 35 deletions

View file

@ -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):

View file

@ -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: