core: make groups field for user optional (#5702)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L 2023-05-21 15:19:05 +02:00 committed by GitHub
parent 5d5938c412
commit bb64fb1130
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 14 deletions

View File

@ -45,7 +45,7 @@ def check_blueprint_v1_file(BlueprintInstance: type, path: Path):
enabled=True,
managed_models=[],
last_applied_hash="",
metadata=metadata,
metadata=metadata or {},
)
instance.save()

View File

@ -106,7 +106,7 @@ class UserSerializer(ModelSerializer):
avatar = CharField(read_only=True)
attributes = JSONField(validators=[is_dict], required=False)
groups = PrimaryKeyRelatedField(
allow_empty=True, many=True, source="ak_groups", queryset=Group.objects.all()
allow_empty=True, many=True, source="ak_groups", queryset=Group.objects.all(), default=list
)
groups_obj = ListSerializer(child=UserGroupSerializer(), read_only=True, source="ak_groups")
uid = CharField(read_only=True)

View File

@ -3888,8 +3888,7 @@
},
"required": [
"username",
"name",
"groups"
"name"
],
"title": "User"
},
@ -4080,8 +4079,7 @@
},
"required": [
"username",
"name",
"groups"
"name"
],
"title": "User"
},
@ -4276,8 +4274,7 @@
},
"required": [
"username",
"name",
"groups"
"name"
],
"title": "User"
},
@ -6424,8 +6421,7 @@
},
"required": [
"username",
"name",
"groups"
"name"
],
"title": "User"
},
@ -7160,8 +7156,7 @@
},
"required": [
"username",
"name",
"groups"
"name"
],
"title": "User"
},

View File

@ -41003,7 +41003,6 @@ components:
type: string
required:
- avatar
- groups
- groups_obj
- is_superuser
- name
@ -41461,7 +41460,6 @@ components:
type: string
minLength: 1
required:
- groups
- name
- username
UserSAMLSourceConnection: