mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Allow for parent/child grouping
This commit is contained in:
@@ -3,6 +3,7 @@ from eve_api.models import EVEAccount, EVEPlayerCorporation, EVEPlayerAlliance
|
||||
from sso.models import ServiceAccount
|
||||
from django.contrib.auth.models import User
|
||||
from django.db.models import signals
|
||||
from utils import installed
|
||||
|
||||
|
||||
# Signals that the tasks need to listen for
|
||||
@@ -45,6 +46,13 @@ def update_user_access(user, **kwargs):
|
||||
delgroups = set(set(user.groups.all()) & set(corpgroups)) - set(chargroups)
|
||||
addgroups = set(chargroups) - set(set(user.groups.all()) & set(corpgroups))
|
||||
|
||||
# Check that user's groups fufil requirements
|
||||
if installed('groups'):
|
||||
for g in user.groups.filter(groupinformation__parent__isnull=False):
|
||||
print g
|
||||
if not g in delgroups and not g.groupinformation.parent in user.groups.all():
|
||||
delgroups.add(g)
|
||||
|
||||
for g in delgroups:
|
||||
if g in user.groups.all():
|
||||
user.groups.remove(g)
|
||||
|
||||
Reference in New Issue
Block a user