From 0f1dffe6afa4949093b8b1a73da2522c17c58743 Mon Sep 17 00:00:00 2001 From: Tim Schroeder Date: Mon, 16 Jul 2018 17:20:36 +0200 Subject: [PATCH] MDL-61351 auth_shibboleth: removed redundant session handler class check --- auth/shibboleth/logout.php | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/auth/shibboleth/logout.php b/auth/shibboleth/logout.php index c9fa33d72ec..f514d4e2b7d 100644 --- a/auth/shibboleth/logout.php +++ b/auth/shibboleth/logout.php @@ -127,27 +127,14 @@ WSDL; * @return SoapFault or void if everything was fine */ function LogoutNotification($spsessionid) { - global $CFG; - - // Delete session of user using $spsessionid. - // The setting $CFG->session_handler_class may not be set. But if it is, - // it should override $CFG->dbsessions. - if (!empty($CFG->session_handler_class)) { - $sessionclass = $CFG->session_handler_class; - if (preg_match('/database/i', $sessionclass) === 1) { - return \auth_shibboleth\helper::logout_db_session($spsessionid); - } else if (preg_match('/file/i', $sessionclass) === 1) { + $sessionclass = \core\session\manager::get_handler_class(); + switch ($sessionclass) { + case '\core\session\file': return \auth_shibboleth\helper::logout_file_session($spsessionid); - } else { - throw new moodle_exception("Shibboleth logout not implemented for '$sessionclass'"); - } - } else { - // Session handler class is not specified, check dbsessions instead. - if (!empty($CFG->dbsessions)) { + case '\core\session\database': return \auth_shibboleth\helper::logout_db_session($spsessionid); - } - // Assume file sessions if dbsessions isn't used. - return \auth_shibboleth\helper::logout_file_session($spsessionid); + default: + throw new moodle_exception("Shibboleth logout not implemented for '$sessionclass'"); } // If no SoapFault was thrown, the function will return OK as the SP assumes. } -- 2.43.0