mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-26 19:54:46 +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());
|
LStemplate :: assign('LSsession_username',self :: getLSuserObject() -> getDisplayName());
|
||||||
|
|
||||||
if (isset ($_POST['LSsession_topDn']) && $_POST['LSsession_topDn']) {
|
if (isset($_POST['LSsession_topDn']) && $_POST['LSsession_topDn'])
|
||||||
if (self :: validSubDnLdapServer($_POST['LSsession_topDn'])) {
|
self :: setSubDn($_POST['LSsession_topDn']);
|
||||||
self :: $topDn = $_POST['LSsession_topDn'];
|
|
||||||
$_SESSION['LSsession']['topDn'] = $_POST['LSsession_topDn'];
|
|
||||||
} // end if
|
|
||||||
} // end if
|
|
||||||
|
|
||||||
return true;
|
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
|
* Set the LDAP server of the session from its ID in configuration array
|
||||||
* le tableau LSconfig :: get('ldap_servers').
|
* 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");
|
$conf = LSconfig :: get("ldap_servers.$id");
|
||||||
if ( is_array($conf) ) {
|
if ( is_array($conf) ) {
|
||||||
self :: $ldapServerId = $id;
|
self :: $ldapServerId = $id;
|
||||||
self :: $ldapServer = $conf;
|
self :: $ldapServer = $conf;
|
||||||
LSlang :: setLocale();
|
LSlang :: setLocale();
|
||||||
self :: setGlobals();
|
self :: setGlobals();
|
||||||
|
|
||||||
|
if ($subDn)
|
||||||
|
return self :: setSubDn($subDn);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
return false;
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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