[Fusionforge-commits] r12751 - in trunk/src/plugins/ldapextauth: etc include

Roland Mas lolando at fusionforge.org
Mon Mar 14 17:47:56 CET 2011


Author: lolando
Date: 2011-03-14 17:47:55 +0100 (Mon, 14 Mar 2011)
New Revision: 12751

Modified:
   trunk/src/plugins/ldapextauth/etc/ldapextauth.ini
   trunk/src/plugins/ldapextauth/include/LdapExtAuthPlugin.class.php
Log:
Cleanup

Modified: trunk/src/plugins/ldapextauth/etc/ldapextauth.ini
===================================================================
--- trunk/src/plugins/ldapextauth/etc/ldapextauth.ini	2011-03-14 16:47:41 UTC (rev 12750)
+++ trunk/src/plugins/ldapextauth/etc/ldapextauth.ini	2011-03-14 16:47:55 UTC (rev 12751)
@@ -11,7 +11,7 @@
 required = no
 sufficient = yes
 
-; Typical values: never, user-creation, login, every-page
+; Allowed values: never, user-creation, login, every-page
 sync_data_on = login
 
 ; LDAP parameters

Modified: trunk/src/plugins/ldapextauth/include/LdapExtAuthPlugin.class.php
===================================================================
--- trunk/src/plugins/ldapextauth/include/LdapExtAuthPlugin.class.php	2011-03-14 16:47:41 UTC (rev 12750)
+++ trunk/src/plugins/ldapextauth/include/LdapExtAuthPlugin.class.php	2011-03-14 16:47:55 UTC (rev 12751)
@@ -143,7 +143,6 @@
 		forge_define_config_item ('ldap_server', $this->name, 'ldap.example.com');
 		forge_define_config_item ('ldap_port', $this->name, 389);
 		forge_define_config_item ('base_dn', $this->name, 'ou=users,dc=example,dc=com');
-		forge_define_config_item ('user_dn', $this->name, 'uid=');
 		forge_define_config_item ('skipped_users', $this->name, '');
 		forge_define_config_item ('manager_dn', $this->name, '');
 		forge_define_config_item ('manager_password', $this->name, '');
@@ -164,7 +163,16 @@
 			ldap_bind($this->ldap_conn);
 		}
 
-		$res = ldap_search($this->ldap_conn, forge_get_config('base_dn', $this->name), forge_get_config('user_dn', $this->name) . $loginname) ;
+		$fieldname = 'uid';
+		foreach (explode(',', forge_get_config('mapping', $this->name))
+			 as $map_entry) {
+			list ($fffield, $ldapfield) = explode('=',$map_entry);
+			if ($fffield = 'username') {
+				$fieldname = $ldapfield;
+			}
+		}
+
+		$res = ldap_search($this->ldap_conn, forge_get_config('base_dn', $this->name), "($ldapfield=$loginname)") ;
 		if (!$res || ldap_count_entries($this->ldap_conn, $res) == 0) {
 			// No user by that name in LDAP directory
 			return false;




More information about the Fusionforge-commits mailing list