core: prevent selecting a group as a parent of itself (#6016)

* core: prevent selecting a group as a parent of itself

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* fix api error when no parent is given

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L
2023-06-20 20:21:58 +02:00
committed by GitHub
parent 5e30f46772
commit 93575a9966
3 changed files with 25 additions and 0 deletions

View File

@ -95,6 +95,9 @@ export class GroupForm extends ModelForm<Group, string> {
args.search = query;
}
const groups = await new CoreApi(DEFAULT_CONFIG).coreGroupsList(args);
if (this.instance) {
return groups.results.filter((g) => g.pk !== this.instance?.pk);
}
return groups.results;
}}
.renderElement=${(group: Group): string => {