From adbf94c95725c24b5b93afc8d3bc24fc057c6a17 Mon Sep 17 00:00:00 2001 From: Gilles-Philippe Leblanc Date: Wed, 11 Sep 2013 13:11:07 -0400 Subject: [PATCH] MDL-41733 auth_cas: Allow direct authentication with CAS to a course when multiple authentication is activated --- auth/cas/auth.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/auth/cas/auth.php b/auth/cas/auth.php index 634e32b2c72..e748bbf007c 100644 --- a/auth/cas/auth.php +++ b/auth/cas/auth.php @@ -96,6 +96,7 @@ class auth_plugin_cas extends auth_plugin_ldap { $site = get_site(); $CASform = get_string('CASform', 'auth_cas'); $username = optional_param('username', '', PARAM_RAW); + $courseid = optional_param('courseid', 0, PARAM_INT); if (!empty($username)) { if (isset($SESSION->wantsurl) && (strstr($SESSION->wantsurl, 'ticket') || @@ -117,6 +118,12 @@ class auth_plugin_cas extends auth_plugin_ldap { $frm = new stdClass(); $frm->username = phpCAS::getUser(); $frm->password = 'passwdCas'; + + // Redirect to a course if multi-auth is activated, authCAS is set to CAS and the courseid is specified. + if ($this->config->multiauth && !empty($courseid)) { + redirect(new moodle_url('/course/view.php', array('id'=>$courseid))); + } + return; }