core: include full users in group API
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
f636414fb7
commit
32fb90e056
|
@ -2,16 +2,20 @@
|
||||||
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):
|
||||||
|
|
117
swagger.yaml
117
swagger.yaml
|
@ -10934,42 +10934,7 @@ 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
|
||||||
|
@ -11020,6 +10985,88 @@ 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:
|
||||||
|
|
Reference in a new issue