Merge branch 'MDL-34819-master' of git://github.com/StudiUM/moodle

This commit is contained in:
Aparup Banerjee 2012-10-09 15:40:20 +08:00
commit cbc15c76ea
3 changed files with 34 additions and 0 deletions

View File

@ -268,6 +268,9 @@ class auth_plugin_cas extends auth_plugin_ldap {
if (!isset($config->certificate_path)) {
$config->certificate_path = '';
}
if (!isset($config->logout_return_url)) {
$config->logout_return_url = '';
}
// LDAP settings
if (!isset($config->host_url)) {
@ -331,6 +334,7 @@ class auth_plugin_cas extends auth_plugin_ldap {
set_config('multiauth', $config->multiauth, $this->pluginconfig);
set_config('certificate_check', $config->certificate_check, $this->pluginconfig);
set_config('certificate_path', $config->certificate_path, $this->pluginconfig);
set_config('logout_return_url', $config->logout_return_url, $this->pluginconfig);
// save LDAP settings
set_config('host_url', trim($config->host_url), $this->pluginconfig);
@ -439,4 +443,19 @@ class auth_plugin_cas extends auth_plugin_ldap {
}
parent::sync_users($do_updates);
}
/**
* Hook for logout page
*/
function logoutpage_hook() {
global $USER, $redirect;
// Only do this if the user is actually logged in via CAS
if ($USER->auth === $this->authtype) {
// Check if there is an alternative logout return url defined
if (isset($this->config->logout_return_url) && !empty($this->config->logout_return_url)) {
// Set redirect to alternative return url
$redirect = $this->config->logout_return_url;
}
}
}
}

View File

@ -33,6 +33,9 @@ if (!isset ($config->certificate_check)) {
if (!isset ($config->certificate_path)) {
$config->certificate_path = '';
}
if (!isset($config->logout_return_url)) {
$config->logout_return_url = '';
}
// set to defaults if undefined (LDAP)
if (!isset($config->host_url)) {
@ -201,6 +204,16 @@ $yesno = array( get_string('no'), get_string('yes') );
<?php print_string('auth_cas_certificate_path', 'auth_cas') ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string('auth_cas_logout_return_url_key', 'auth_cas') ?>:</td>
<td>
<input name="logout_return_url" type="text" size="30" value="<?php echo $config->logout_return_url ?>" />
<?php if (isset($err['logout_return_url'])) { echo $OUTPUT->error_text($err['logout_return_url']); } ?>
</td>
<td>
<?php print_string('auth_cas_logout_return_url', 'auth_cas') ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string('auth_ldap_server_settings', 'auth_ldap') ?></h4>

View File

@ -47,6 +47,8 @@ $string['auth_cas_invalidcaslogin'] = 'Sorry, your login has failed - you could
$string['auth_cas_language'] = 'Select language for authentication pages';
$string['auth_cas_language_key'] = 'Language';
$string['auth_cas_logincas'] = 'Secure connection access';
$string['auth_cas_logout_return_url_key'] = 'Alternative logout return URL';
$string['auth_cas_logout_return_url'] = 'Provide the URL that CAS users shall be redirected to after logging out.<br />If left empty, users will be redirected to the location that moodle will redirect users to';
$string['auth_cas_logoutcas'] = 'Select \'yes\' if you want to logout from CAS when you disconnect from Moodle';
$string['auth_cas_logoutcas_key'] = 'CAS logout option';
$string['auth_cas_multiauth'] = 'Select \'yes\' if you want to have multi-authentication (CAS + other authentication)';