diff --git a/authentik/policies/forms.py b/authentik/policies/forms.py index b737ec817..f4c4eeddb 100644 --- a/authentik/policies/forms.py +++ b/authentik/policies/forms.py @@ -2,6 +2,7 @@ from django import forms +from authentik.core.models import Group from authentik.lib.widgets import GroupedModelChoiceField from authentik.policies.models import Policy, PolicyBinding, PolicyBindingModel @@ -19,6 +20,9 @@ class PolicyBindingForm(forms.ModelForm): policy = GroupedModelChoiceField( queryset=Policy.objects.all().select_subclasses(), ) + group = forms.ModelChoiceField( + queryset=Group.objects.all().order_by("name"), required=False + ) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/authentik/policies/group_membership/forms.py b/authentik/policies/group_membership/forms.py index 250f74ca6..9a6c89471 100644 --- a/authentik/policies/group_membership/forms.py +++ b/authentik/policies/group_membership/forms.py @@ -2,6 +2,7 @@ from django import forms +from authentik.core.models import Group from authentik.policies.forms import GENERAL_FIELDS from authentik.policies.group_membership.models import GroupMembershipPolicy @@ -9,6 +10,8 @@ from authentik.policies.group_membership.models import GroupMembershipPolicy class GroupMembershipPolicyForm(forms.ModelForm): """GroupMembershipPolicy Form""" + group = forms.ModelChoiceField(queryset=Group.objects.all().order_by("name")) + class Meta: model = GroupMembershipPolicy