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

@ -3,7 +3,7 @@
/**
* @author Martin Dougiamas
* @author Jerome GUTIERREZ
* @author I<EFBFBD>aki Arenaza
* @author Iñaki Arenaza
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package moodle multiauth
*
@ -206,6 +206,10 @@ class auth_plugin_cas extends auth_plugin_ldap {
}
}
if (!ldap_paged_results_supported($this->config->ldap_version)) {
echo $OUTPUT->notification(get_string('pagedresultsnotsupp', 'auth_ldap'));
}
include($CFG->dirroot.'/auth/cas/config.html');
}
@ -279,6 +283,9 @@ class auth_plugin_cas extends auth_plugin_ldap {
if (empty($config->ldapencoding)) {
$config->ldapencoding = 'utf-8';
}
if (!isset($config->pagesize)) {
$config->pagesize = LDAP_DEFAULT_PAGESIZE;
}
if (!isset($config->contexts)) {
$config->contexts = '';
}
@ -339,6 +346,7 @@ class auth_plugin_cas extends auth_plugin_ldap {
// save LDAP settings
set_config('host_url', trim($config->host_url), $this->pluginconfig);
set_config('ldapencoding', trim($config->ldapencoding), $this->pluginconfig);
set_config('pagesize', (int)trim($config->pagesize), $this->pluginconfig);
set_config('contexts', trim($config->contexts), $this->pluginconfig);
set_config('user_type', textlib::strtolower(trim($config->user_type)), $this->pluginconfig);
set_config('user_attribute', textlib::strtolower(trim($config->user_attribute)), $this->pluginconfig);

View file

@ -44,6 +44,9 @@ if (!isset($config->host_url)) {
if (empty($config->ldapencoding)) {
$config->ldapencoding = 'utf-8';
}
if (!isset($config->pagesize)) {
$config->pagesize = LDAP_DEFAULT_PAGESIZE;
}
if (!isset($config->contexts)) {
$config->contexts = '';
}
@ -258,6 +261,25 @@ $yesno = array( get_string('no'), get_string('yes') );
<?php print_string('auth_ldap_ldap_encoding', 'auth_ldap') ?>
</td>
</tr>
<tr valign="top">
<td align="right">
<label for="pagesize"><?php print_string('pagesize_key', 'auth_ldap') ?></label>
</td>
<td>
<?php $disabled = (!ldap_paged_results_supported($config->ldap_version)) ? ' disabled="disabled"' : '' ; ?>
<input id="pagesize" name="pagesize" type="text" value="<?php echo $config->pagesize ?>" <?php echo $disabled ?>/>
<?php
if (isset($err['pagesize'])) { echo $OUTPUT->error_text($err['pagesize']); }
if ($disabled) {
// Don't loose the page size value (disabled fields are not submitted!)
?>
<input id="pagesize" name="pagesize" type="hidden" value="<?php echo $config->pagesize ?>" />
<?php } ?>
</td>
<td>
<?php print_string('pagesize', 'auth_ldap') ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string('auth_ldap_bind_settings', 'auth_ldap') ?></h4>

View file

@ -27,6 +27,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
$plugin->version = 2012110700; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component = 'auth_cas'; // Full name of the plugin (used for diagnostics)