mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 18:09:06 +01:00
LSsession: add setSubDn() method
This commit is contained in:
parent
1420439403
commit
3dbfe18afb
1 changed files with 29 additions and 14 deletions
|
@ -684,12 +684,8 @@ class LSsession {
|
|||
|
||||
LStemplate :: assign('LSsession_username',self :: getLSuserObject() -> getDisplayName());
|
||||
|
||||
if (isset ($_POST['LSsession_topDn']) && $_POST['LSsession_topDn']) {
|
||||
if (self :: validSubDnLdapServer($_POST['LSsession_topDn'])) {
|
||||
self :: $topDn = $_POST['LSsession_topDn'];
|
||||
$_SESSION['LSsession']['topDn'] = $_POST['LSsession_topDn'];
|
||||
} // end if
|
||||
} // end if
|
||||
if (isset($_POST['LSsession_topDn']) && $_POST['LSsession_topDn'])
|
||||
self :: setSubDn($_POST['LSsession_topDn']);
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -1130,27 +1126,46 @@ class LSsession {
|
|||
}
|
||||
|
||||
/**
|
||||
* Définition du serveur Ldap de la session
|
||||
* Set the LDAP server of the session
|
||||
*
|
||||
* Définition du serveur Ldap de la session à partir de son ID dans
|
||||
* le tableau LSconfig :: get('ldap_servers').
|
||||
* Set the LDAP server of the session from its ID in configuration array
|
||||
* LSconfig :: get('ldap_servers').
|
||||
*
|
||||
* @param[in] integer Index du serveur Ldap
|
||||
* @param[in] $id integer Index of LDAP server
|
||||
* @param[in] $subDn integer SubDN of LDAP server (optional)
|
||||
*
|
||||
* @retval boolean True sinon false.
|
||||
* @retval boolean True if set, false otherwise
|
||||
*/
|
||||
public static function setLdapServer($id) {
|
||||
public static function setLdapServer($id, $subDn=null) {
|
||||
$conf = LSconfig :: get("ldap_servers.$id");
|
||||
if ( is_array($conf) ) {
|
||||
self :: $ldapServerId = $id;
|
||||
self :: $ldapServer = $conf;
|
||||
LSlang :: setLocale();
|
||||
self :: setGlobals();
|
||||
|
||||
if ($subDn)
|
||||
return self :: setSubDn($subDn);
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the subDn of the session
|
||||
*
|
||||
* @param[in] $subDn string SubDN of LDAP server
|
||||
*
|
||||
* @retval boolean True if set, false otherwise
|
||||
*/
|
||||
public static function setSubDn($subDn) {
|
||||
if (self :: validSubDnLdapServer($subDn)) {
|
||||
self :: $topDn = $subDn;
|
||||
$_SESSION['LSsession']['topDn'] = $subDn;
|
||||
return true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue