From b52181a769f65589046be84faa7cf6339ba1ab57 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 9 Mar 2009 13:14:37 +0000 Subject: [PATCH] =?UTF-8?q?-=20LSldapObject=20:=20Modification=20de=20la?= =?UTF-8?q?=20m=C3=A9thode=20searchObject()=20pour=20prendre=20eventuellem?= =?UTF-8?q?ent=20=20=20un=20troisi=C3=A8me=20param=C3=A8tre=20:=20un=20LSf?= =?UTF-8?q?ormat=20du=20filtre=20de=20recherche=20compos=C3=A9=20avec=20la?= =?UTF-8?q?=20valeur=20=20=20du=20premi=C3=A8re=20argument.=20-=20LSsessio?= =?UTF-8?q?n=20:=20Ajout=20de=20la=20possibilit=C3=A9=20de=20d=C3=A9finir?= =?UTF-8?q?=20le=20filtre=20de=20recherche=20LDAP=20de=20l'objet=20=20=20u?= =?UTF-8?q?tilisateur=20d'une=20personne=20se=20connectant.=20(authObjectF?= =?UTF-8?q?ilter)=20-=20config.inc.php=20:=20Ajout=20de=20la=20possibilit?= =?UTF-8?q?=C3=A9=20de=20s'authentifier=20avec=20son=20mail.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trunk/conf/config.inc.php | 1 + trunk/includes/class/class.LSldapObject.php | 16 ++++++++++++---- trunk/includes/class/class.LSsession.php | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/trunk/conf/config.inc.php b/trunk/conf/config.inc.php index d489b312..9d4cd558 100644 --- a/trunk/conf/config.inc.php +++ b/trunk/conf/config.inc.php @@ -72,6 +72,7 @@ $GLOBALS['LSconfig'] = array( 'cacheLSprofiles' => true, 'cacheSearch' => true, 'authObjectType' => 'LSeepeople', + 'authObjectFilter' => '(|(uid=%{user})(mail=%{user}))', 'authobject_pwdattr' => 'userPassword', 'LSaccess' => array( 'LSeepeople', diff --git a/trunk/includes/class/class.LSldapObject.php b/trunk/includes/class/class.LSldapObject.php index 3bd1c3f5..4e8f8dd9 100644 --- a/trunk/includes/class/class.LSldapObject.php +++ b/trunk/includes/class/class.LSldapObject.php @@ -929,17 +929,25 @@ class LSldapObject { /** - * Recherche un objet à partir de la valeur exact de son RDN + * Recherche un objet à partir de la valeur exact de son RDN ou d'un filtre de + * recherche LDAP sous la forme d'un LSformat qui sera construit avec la valeur + * de $name. * * @author Benjamin Renard * - * @param[in] $name string Valeur de son RDN + * @param[in] $name string Valeur de son RDN ou de la valeur pour composer le filtre * @param[in] $basedn string Le DN de base de la recherche + * @param[in] $filter string Le filtre de recherche de l'objet * * @retval array Tableau d'objets correspondant au resultat de la recherche */ - function searchObject($name,$basedn=NULL) { - $filter = $this -> config['rdn'].'='.$name; + function searchObject($name,$basedn=NULL,$filter=NULL) { + if (!$filter) { + $filter = $this -> config['rdn'].'='.$name; + } + else { + $filter = getFData($filter,$name); + } return $this -> listObjects($filter,$basedn); } diff --git a/trunk/includes/class/class.LSsession.php b/trunk/includes/class/class.LSsession.php index 4a353ead..f1e3411b 100644 --- a/trunk/includes/class/class.LSsession.php +++ b/trunk/includes/class/class.LSsession.php @@ -373,7 +373,7 @@ class LSsession { } } if ($find) { - $result = $authobject -> searchObject($_POST['LSsession_user'],self :: $topDn); + $result = $authobject -> searchObject($_POST['LSsession_user'],self :: $topDn,self :: $ldapServer['authObjectFilter']); $nbresult=count($result); } if ($nbresult==0) { @@ -525,7 +525,7 @@ class LSsession { // Authentification réussi self :: $LSuserObject = $result[0]; self :: $dn = $result[0]->getValue('dn'); - self :: $rdn = $_POST['LSsession_user']; + self :: $rdn = $result[0]->getValue('rdn'); self :: loadLSprofiles(); self :: loadLSaccess(); $GLOBALS['Smarty'] -> assign('LSsession_username',self :: getLSuserObject() -> getDisplayName());