diff --git a/rbac/engine/classes/plugins/class.ldap.php b/rbac/engine/classes/plugins/class.ldap.php index 71fb7affe..1bd1f1872 100755 --- a/rbac/engine/classes/plugins/class.ldap.php +++ b/rbac/engine/classes/plugins/class.ldap.php @@ -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; } diff --git a/workflow/engine/methods/authSources/authSources_Ajax.php b/workflow/engine/methods/authSources/authSources_Ajax.php index 2c065d382..807b02cd5 100755 --- a/workflow/engine/methods/authSources/authSources_Ajax.php +++ b/workflow/engine/methods/authSources/authSources_Ajax.php @@ -95,11 +95,11 @@ try { global $G_PUBLISH; $G_PUBLISH = new Publisher(); if ($aFields['AUTH_SOURCE_PROVIDER'] != 'ldap') { - $G_PUBLISH->AddContent('propeltable', 'paged-table', 'authSources/ldapSearchResults', $oCriteria,' ',array('Checkbox' => G::LoadTranslation('ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER'))); + $G_PUBLISH->AddContent('propeltable', 'pagedTableLdap', 'authSources/ldapSearchResults', $oCriteria,' ',array('Checkbox' => G::LoadTranslation('ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER'))); } else { if (file_exists(PATH_XMLFORM . 'authSources/' . $aFields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml')) { - $G_PUBLISH->AddContent('propeltable', 'paged-table', 'authSources/' . $aFields['AUTH_SOURCE_PROVIDER'] . 'SearchResults', $oCriteria,' ',array('Checkbox' => G::LoadTranslation('ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER'))); + $G_PUBLISH->AddContent('propeltable', 'pagedTableLdap', 'authSources/' . $aFields['AUTH_SOURCE_PROVIDER'] . 'SearchResults', $oCriteria,' ',array('Checkbox' => G::LoadTranslation('ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER'))); } else { $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => 'File: ' . $aFields['AUTH_SOURCE_PROVIDER'] . 'SearchResults.xml' . ' doesn\'t exist.')); diff --git a/workflow/engine/templates/pagedTableLdap.html b/workflow/engine/templates/pagedTableLdap.html new file mode 100644 index 000000000..368444254 --- /dev/null +++ b/workflow/engine/templates/pagedTableLdap.html @@ -0,0 +1,144 @@ + +
+
+
+ + + + +
+ +
{title}
+ + + + +
{content}
+ + + + + + + + + + + + + + + + + + + + + + + + + + {value} + + + + + + + + + + + + + + + + + + + + + +
+ {header} +
{value1}{value} 
  + {noRecordsFound}
  +
+ + + + + + + +
+ {labels:ID_ROWS} {firstRow}-{lastRow}/{totalRows}  + + {first} {prev} {next} {last} + {labels:ID_PAGE} {currentPage}/{totalPages}
+
+ +
+
+
+
+ + + + + \ No newline at end of file diff --git a/workflow/engine/xmlform/authSources/authSources_SearchUsers.html b/workflow/engine/xmlform/authSources/authSources_SearchUsers.html index 707b0f35b..f9994abec 100755 --- a/workflow/engine/xmlform/authSources/authSources_SearchUsers.html +++ b/workflow/engine/xmlform/authSources/authSources_SearchUsers.html @@ -24,9 +24,6 @@ - - -
    {$form.CheckboxSelectAll}
diff --git a/workflow/engine/xmlform/authSources/authSources_SearchUsers.xml b/workflow/engine/xmlform/authSources/authSources_SearchUsers.xml index 33c03ff21..3224d600f 100755 --- a/workflow/engine/xmlform/authSources/authSources_SearchUsers.xml +++ b/workflow/engine/xmlform/authSources/authSources_SearchUsers.xml @@ -23,47 +23,41 @@ Cancel - - - - diff --git a/workflow/engine/xmlform/authSources/authSources_SearchUsersMenu.xml b/workflow/engine/xmlform/authSources/authSources_SearchUsersMenu.xml new file mode 100644 index 000000000..8171f0f17 --- /dev/null +++ b/workflow/engine/xmlform/authSources/authSources_SearchUsersMenu.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + diff --git a/workflow/engine/xmlform/authSources/ldapSearchResults.xml b/workflow/engine/xmlform/authSources/ldapSearchResults.xml index 5c04b323c..9ed6d1218 100755 --- a/workflow/engine/xmlform/authSources/ldapSearchResults.xml +++ b/workflow/engine/xmlform/authSources/ldapSearchResults.xml @@ -1,15 +1,15 @@ - + - + ]]> - + Name - + E-Mail]]>