In configure we do not need to set_config()
[cascardo/ipsilon.git] / ipsilon / login / authldap.py
index 0d70479..ed75e91 100755 (executable)
@@ -64,7 +64,15 @@ class LDAP(LoginFormBase, Log):
 
         if username and password:
             try:
-                userattrs = self._authenticate(username, password)
+                userdata = self._authenticate(username, password)
+                if userdata:
+                    userattrs = dict()
+                    for d, v in userdata.get('userdata', {}).items():
+                        userattrs[d] = v
+                    if 'groups' in userdata:
+                        userattrs['groups'] = userdata['groups']
+                    if 'extras' in userdata:
+                        userattrs['extras'] = userdata['extras']
                 authed = True
             except Exception, e:  # pylint: disable=broad-except
                 errmsg = "Authentication failed"
@@ -204,8 +212,7 @@ class Installer(object):
         if 'ldap_bind_dn_template' in opts:
             config['bind dn template'] = opts['ldap_bind_dn_template']
         config['tls'] = 'Demand'
-        po.set_config(config)
-        po.save_plugin_config(FACILITY)
+        po.save_plugin_config(FACILITY, config)
 
         # Update global config to add login plugin
         po = PluginObject()
@@ -217,5 +224,4 @@ class Installer(object):
             order = []
         order.append('ldap')
         globalconf['order'] = ','.join(order)
-        po.set_config(globalconf)
-        po.save_plugin_config(FACILITY)
+        po.save_plugin_config(FACILITY, globalconf)