Commit 94e3de4b by Őry Máté

dashboard: refactor GroupCodeMixin

parent 932297bf
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
from __future__ import unicode_literals, absolute_import from __future__ import unicode_literals, absolute_import
from itertools import chain
from os import getenv from os import getenv
import json import json
import logging import logging
...@@ -108,13 +109,8 @@ class GroupCodeMixin(object): ...@@ -108,13 +109,8 @@ class GroupCodeMixin(object):
attributes = identity[0] attributes = identity[0]
owneratrs = getattr( owneratrs = getattr(
settings, 'SAML_GROUP_OWNER_ATTRIBUTES', []) settings, 'SAML_GROUP_OWNER_ATTRIBUTES', [])
groups = [] for group in chain(*[attributes[i]
for i in owneratrs: for i in owneratrs if i in attributes]):
try:
groups += attributes[i]
except KeyError:
pass
for group in groups:
try: try:
GroupProfile.search(group) GroupProfile.search(group)
except Group.DoesNotExist: except Group.DoesNotExist:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment