Commit a931fe31 by Őry Máté

dashboard: handle keyerrors in saml attributes

parent bd781d07
......@@ -165,7 +165,8 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
logger.debug("org_id of %s already added to user %s's profile",
value, sender.username)
memberatrs = getattr(settings, 'SAML_GROUP_ATTRIBUTES', [])
for group in chain(*[attributes[i] for i in memberatrs]):
for group in chain(*[attributes[i]
for i in memberatrs if i in attributes]):
try:
g = GroupProfile.search(group)
except Group.DoesNotExist:
......@@ -176,7 +177,8 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
g.user_set.add(sender)
owneratrs = getattr(settings, 'SAML_GROUP_OWNER_ATTRIBUTES', [])
for group in chain(*[attributes[i] for i in owneratrs]):
for group in chain(*[attributes[i]
for i in owneratrs if i in attributes]):
try:
g = GroupProfile.search(group)
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