core: use only user ids for group

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-03-28 22:03:48 +02:00
parent d358dc1182
commit bd9c0efab7
2 changed files with 35 additions and 86 deletions

View File

@ -2,20 +2,16 @@
from rest_framework.serializers import ModelSerializer from rest_framework.serializers import ModelSerializer
from rest_framework.viewsets import ModelViewSet from rest_framework.viewsets import ModelViewSet
from authentik.core.api.users import UserSerializer
from authentik.core.models import Group from authentik.core.models import Group
class GroupSerializer(ModelSerializer): class GroupSerializer(ModelSerializer):
"""Group Serializer""" """Group Serializer"""
users = UserSerializer(many=True)
class Meta: class Meta:
model = Group model = Group
fields = ["pk", "name", "is_superuser", "parent", "users", "attributes"] fields = ["pk", "name", "is_superuser", "parent", "users", "attributes"]
depth = 2
class GroupViewSet(ModelViewSet): class GroupViewSet(ModelViewSet):

View File

@ -10934,7 +10934,42 @@ definitions:
format: uuid format: uuid
readOnly: true readOnly: true
uniqueItems: 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: User:
title: User
description: User Serializer description: User Serializer
required: required:
- username - username
@ -10985,88 +11020,6 @@ definitions:
attributes: attributes:
title: Attributes title: Attributes
type: object 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: Token:
description: Token Serializer description: Token Serializer
required: required: