save provisioned users (#6667)

This commit is contained in:
Frédéric Péters 2015-03-10 14:08:33 +01:00
parent 9c83540415
commit 40a31aba9e
1 changed files with 4 additions and 0 deletions

View File

@ -68,6 +68,7 @@ class DefaultAdapter(object):
def provision_attribute(self, user, idp, saml_attributes):
realm = utils.get_setting(idp, 'REALM')
attribute_mapping = utils.get_setting(idp, 'ATTRIBUTE_MAPPING')
attribute_set = False
for field, tpl in attribute_mapping.iteritems():
try:
value = unicode(tpl).format(realm=realm, attributes=saml_attributes, idp=idp)
@ -76,7 +77,10 @@ class DefaultAdapter(object):
except (AttributeError, KeyError, IndexError, ValueError), e:
log.warning('invalid reference in attribute mapping template %r: %s', tpl, e)
else:
attribute_set = True
setattr(user, field, value)
if attribute_set:
user.save()
def provision_superuser(self, user, idp, saml_attributes):
superuser_mapping = utils.get_setting(idp, 'SUPERUSER_MAPPING')