MDL-36119: auth_{ldap,cas}: LDAP Sync - implement paged results

Thanks to Jerome Charaoui for the original patch.
This commit is contained in:
Iñaki Arenaza 2012-10-31 17:41:44 +01:00
parent 6109f2112c
commit c090d7c90e
12 changed files with 282 additions and 110 deletions

View file

@ -7,11 +7,11 @@
* data structures, useful for both ldap authentication (or ldap based
* authentication like CAS) and enrolment plugins.
*
* @author I<EFBFBD>aki Arenaza
* @author Iñaki Arenaza
* @package core
* @subpackage lib
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
* @copyright 2010 onwards I<EFBFBD>aki Arenaza
* @copyright 2010 onwards Iñaki Arenaza
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -22,6 +22,11 @@ if (!defined('ROOTDSE')) {
define ('ROOTDSE', '');
}
// Default page size when using LDAP paged results
if (!defined('LDAP_DEFAULT_PAGESIZE')) {
define('LDAP_DEFAULT_PAGESIZE', 250);
}
/**
* Returns predefined user types
*
@ -364,3 +369,24 @@ function ldap_stripslashes($text) {
return $text;
}
/**
* Check if PHP supports LDAP paged results and we can use them (we have to use LDAP
* version 3, otherwise the server doesn't use them).
*
* @param ldapversion integer The LDAP protocol version we use.
*
* @return boolean true is paged results can be used, false otherwise.
*/
function ldap_paged_results_supported($ldapversion) {
if (((int)$ldapversion === 3) &&
function_exists('ldap_control_paged_result') &&
function_exists('ldap_control_paged_result_response')) {
return true;
}
return false;
}