mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +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):
|
||||
""" 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):
|
||||
""" Service Account Form """
|
||||
|
||||
Reference in New Issue
Block a user