*: add validator to ensure JSON Fields only receive dicts

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-04-11 23:05:19 +02:00
parent a0daaabfde
commit 4f27a97e10
8 changed files with 47 additions and 8 deletions

View File

@ -1,13 +1,17 @@
"""Groups API Viewset"""
from rest_framework.fields import JSONField
from rest_framework.serializers import ModelSerializer
from rest_framework.viewsets import ModelViewSet
from authentik.core.api.utils import is_dict
from authentik.core.models import Group
class GroupSerializer(ModelSerializer):
"""Group Serializer"""
attributes = JSONField(validators=[is_dict])
class Meta:
model = Group