Mise en place nouveau du filtre de recherche ldap afin de pouvoir trier les rsultats
correction de diffrents bugs
This commit is contained in:
parent
bcaec2a4c3
commit
ce965c2ebc
@ -52,6 +52,7 @@ if ($_GET["action"] == 'setvalue' && $user->admin)
|
||||
if (! dolibarr_set_const($db, 'LDAP_KEY_USERS',$_POST["key"])) $error++;
|
||||
|
||||
if (! dolibarr_set_const($db, 'LDAP_USER_DN',$_POST["user"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FILTER_CONNECTION',$_POST["filterconnection"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_FULLNAME',$_POST["fieldfullname"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_LOGIN',$_POST["fieldlogin"])) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_LOGIN_SAMBA',$_POST["fieldloginsamba"])) $error++;
|
||||
@ -116,6 +117,15 @@ print '</td><td>'.$langs->trans("LDAPUserDnExample").'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Filtre
|
||||
//Utilise pour filtrer la recherche
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFilterConnection").'</td><td>';
|
||||
print '<input size="48" type="text" name="filterconnection" value="'.$conf->global->LDAP_FILTER_CONNECTION.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFilterConnectionExample").'</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -127,15 +137,6 @@ print '<td colspan="2">'.$langs->trans("LDAPLdapMapping").'</td>';
|
||||
print '<td align="right">'.$langs->trans("LDAPNamingAttribute").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Filtre
|
||||
/*
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td><b>'.$langs->trans("LDAPFilterConnection").picto_required().'</b></td><td>';
|
||||
print '<input size="38" type="text" name="filterconnection" value="'.$conf->global->LDAP_FILTER_CONNECTION.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFilterConnectionExample").'</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
// Common name
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFullname").'</td><td>';
|
||||
|
||||
@ -719,7 +719,7 @@ class Ldap
|
||||
* username. The search criteria is a standard LDAP query - * returns all
|
||||
* users. The $attributeArray variable contains the required user detail field names
|
||||
*/
|
||||
function getUsers($search, $userDn, $useridentifier, $attributeArray)
|
||||
function getUsers($search, $userDn, $useridentifier, $attributeArray, $activefilter=0)
|
||||
{
|
||||
$userslist=array();
|
||||
|
||||
@ -730,7 +730,15 @@ class Ldap
|
||||
$this->bindauth($this->searchUser, $this->searchPassword);
|
||||
}
|
||||
|
||||
$filter = '('.$useridentifier.'='.$search.')';
|
||||
if ($activefilter == 1)
|
||||
{
|
||||
$filter = $this->filter;
|
||||
}
|
||||
else
|
||||
{
|
||||
$filter = '('.$useridentifier.'='.$search.')';
|
||||
}
|
||||
|
||||
$this->result = @ldap_search($this->connection, $userDn, $filter);
|
||||
|
||||
if (!$this->result)
|
||||
|
||||
@ -332,13 +332,13 @@ if ($_POST["action"] == 'adduserldap')
|
||||
foreach ($ldapusers as $key => $attribute)
|
||||
{
|
||||
$ldap_nom = $attribute[$conf->global->LDAP_FIELD_NAME];
|
||||
$ldap_prenom = $attribute[$conf->global->LDAP_FIELD_NAME];
|
||||
$ldap_prenom = $attribute[$conf->global->LDAP_FIELD_FIRSTNAME];
|
||||
$ldap_login = $attribute[$conf->global->LDAP_FIELD_LOGIN_SAMBA];
|
||||
$ldap_phone = $attribute[$conf->global->LDAP_FIELD_LOGIN_PHONE];
|
||||
$ldap_fax = $attribute[$conf->global->LDAP_FIELD_LOGIN_FAX];
|
||||
$ldap_mobile = $attribute[$conf->global->LDAP_FIELD_LOGIN_MOBILE];
|
||||
$ldap_mail = $attribute[$conf->global->LDAP_FIELD_LOGIN_MAIL];
|
||||
$ldap_sid = $attribute[$conf->global->LDAP_FIELD_LOGIN_SID];
|
||||
$ldap_phone = $attribute[$conf->global->LDAP_FIELD_PHONE];
|
||||
$ldap_fax = $attribute[$conf->global->LDAP_FIELD_FAX];
|
||||
$ldap_mobile = $attribute[$conf->global->LDAP_FIELD_MOBILE];
|
||||
$ldap_mail = $attribute[$conf->global->LDAP_FIELD_MAIL];
|
||||
$ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -391,12 +391,12 @@ if (($action == 'create') || ($action == 'adduserldap'))
|
||||
if ($result >= 0)
|
||||
{
|
||||
$justthese=array($conf->global->LDAP_KEY_USERS,
|
||||
$conf->global->LDAP_FIELD_FULLNAME,
|
||||
$conf->global->LDAP_FIELD_NAME,
|
||||
$conf->global->LDAP_FIELD_FIRSTNAME,
|
||||
$conf->global->LDAP_FIELD_LOGIN_SAMBA);
|
||||
$conf->global->LDAP_FIELD_FULLNAME,
|
||||
$conf->global->LDAP_FIELD_NAME,
|
||||
$conf->global->LDAP_FIELD_FIRSTNAME,
|
||||
$conf->global->LDAP_FIELD_LOGIN_SAMBA);
|
||||
|
||||
$ldapusers = $ldap->getUsers('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $justthese);
|
||||
$ldapusers = $ldap->getUsers('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $justthese, 1);
|
||||
if (is_array($ldapusers))
|
||||
{
|
||||
$liste=array();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user