mirror of
https://github.com/nikdoof/test-auth.git
synced 2026-01-31 08:28:15 +00:00
SeviceAccountForn will only present services that the user isn't registered for
This commit is contained in:
@@ -41,7 +41,11 @@ class ServiceUsernameField(forms.CharField):
|
|||||||
def UserServiceAccountForm(user):
|
def UserServiceAccountForm(user):
|
||||||
""" Generate a Service Account form based on the user's permissions """
|
""" Generate a Service Account form based on the user's permissions """
|
||||||
|
|
||||||
services = Service.objects.filter(groups__in=user.groups.all())
|
current_services = []
|
||||||
|
for sa in ServiceAccount.objects.filter(user=user):
|
||||||
|
current_services.append(sa.service)
|
||||||
|
|
||||||
|
services = set(Service.objects.filter(groups__in=user.groups.all())) - set(current_services)
|
||||||
|
|
||||||
class ServiceAccountForm(forms.Form):
|
class ServiceAccountForm(forms.Form):
|
||||||
""" Service Account Form """
|
""" Service Account Form """
|
||||||
|
|||||||
Reference in New Issue
Block a user