BUG 9218 Con el plugin ldap v.1.4.26, haciendo upgrade... SOLVED

- The ldap list was generated with an excessive size and the checkboxes
 were not selected in the entire page.

- The Ldap list was optimized to generate it with the smallest size possible

- It was created a new template to improve the selection of the checkbox.
This commit is contained in:
Marco Antonio Nina
2012-06-01 12:25:13 -04:00
parent 9a4db4545b
commit f820ee08f7
6 changed files with 181 additions and 94 deletions

View File

@@ -147,37 +147,18 @@ class LDAP
$sKeyword .= '*';
}
}
$sFilter = '(&';
if (count($aAuthSource['AUTH_SOURCE_OBJECT_CLASSES']) > 0) {
$sFilter .= '(|';
$aObjects = explode("\n", $aAuthSource['AUTH_SOURCE_OBJECT_CLASSES']);
foreach ($aObjects as $sObject) {
$sFilter .= '(objectClass=' . trim($sObject) . ')';
}
$sFilter .= ')';
$sFilter = '(&(|(objectClass=*))';
if ( isset( $aAuthSource['AUTH_SOURCE_DATA']['LDAP_TYPE']) && $aAuthSource['AUTH_SOURCE_DATA']['LDAP_TYPE'] == 'ad' ) {
$sFilter = "(&(|(objectClass=*))(|(samaccountname=$sKeyword)(userprincipalname=$sKeyword))(objectCategory=person))";
}
if (count($aAuthSource['AUTH_SOURCE_ATTRIBUTES']) > 0) {
$sFilter .= '(|';
$aAttributes = explode("\n", $aAuthSource['AUTH_SOURCE_ATTRIBUTES']);
foreach ($aAttributes as $sObject) {
$sObject = trim($sObject);
if ($sObject != '') {
$sFilter .= '(' . trim($sObject) . '=' . $sKeyword . ')';
}
}
$sFilter .= ')';
}
// note added by gustavo cruz gustavo-at-colosa.com
// code added in order to add the data of the aditional filter field
// the nature of the filter and the correct use will be explained in a
// future blog post
$sFilter .= isset($aAuthSource['AUTH_SOURCE_DATA']['AUTH_SOURCE_ADDITIONAL_FILTER'])
? $aAuthSource['AUTH_SOURCE_DATA']['AUTH_SOURCE_ADDITIONAL_FILTER'] :'' ;
$sFilter .= ')';
else
$sFilter = "(&(|(objectClass=*))(|(uid=$sKeyword)(cn=$sKeyword)))";
// G::pr($sFilter);
//G::pr($sFilter);
$aUsers = array();
$oSearch = @ldap_search($oLink, $aAuthSource['AUTH_SOURCE_BASE_DN'], $sFilter);
$oSearch = @ldap_search($oLink, $aAuthSource['AUTH_SOURCE_BASE_DN'], $sFilter, array('dn','uid','samaccountname', 'cn','givenname','sn','mail','userprincipalname','objectcategory', 'manager'));
if ($oError = @ldap_errno($oLink)) {
return $aUsers;
}