============tool/projeqtor.php========== *** tool/projeqtor.php.orig 2017-11-10 13:55:10.000000000 +0100 --- tool/projeqtor.php 2017-11-27 15:55:07.000000000 +0100 *************** *** 151,156 **** --- 151,174 ---- } $page = $_SERVER ['PHP_SELF']; if (! (isset ( $maintenance ) and $maintenance) and ! (isset ( $batchMode ) and $batchMode) and ! (isset ( $indexPhp ) and $indexP hp)) { + // Dhn: Modif CAS + if (isset($paramCASEnabled) and $paramCASEnabled) { + $user = SqlElement::getSingleSqlElementFromCriteria ( 'User', array ( + 'name' => (isset($_SERVER[$paramCASHeaderName]) ? $_SERVER[$paramCASHeaderName] : '') + ) ); + if (!$user->id) { + if (isset($paramCASOnly) and $paramCASOnly) { + echo "Cannot find the CAS user " . $_SERVER['REMOTE_USER']; + die(); + } else { + $paramCASEnabled = false; + } + } + } + if (isset($paramCASEnabled) and $paramCASEnabled) { + // ok + } else { + // Get the user from session. If not exists, request connection =============== if (getSessionUser() and getSessionUser()->id) { $user = getSessionUser(); *************** *** 254,259 **** --- 272,279 ---- } } } + // Dhn: Modif CAS + } if (isset ( $user )) { Audit::updateAudit (); } *************** *** 2934,2939 **** --- 2954,2966 ---- // Functions to get and set current user value from session function getSessionUser() { + // Dhn: Modif CAS + global $paramCASEnabled; + if (isset($paramCASEnabled) AND $paramCASEnabled) { + global $user; + return $user; + } + $user=getSessionValue('user'); if ($user===null) { return new User(); *************** *** 2950,2955 **** --- 2977,2989 ---- } } function sessionUserExists() { + // Dhn: Modif CAS + global $paramCASEnabled; + if (isset($paramCASEnabled) AND $paramCASEnabled) { + global $user; + return !!$user; + } + $user=getSessionValue('user'); if ($user===null) { return false; ============view/js/projeqtor.js========== *** view/js/projeqtor.js.orig 2017-11-10 13:55:10.000000000 +0100 --- view/js/projeqtor.js 2017-11-27 15:56:13.000000000 +0100 *************** *** 2402,2408 **** } //#2887 var callBack = function(){ ! window.location = "../index.php"; } saveDataToSession("disconnect", extUrl, null, callBack);/* saveDataToSession("disconnect"+extUrl, "origin=disconnect"); --- 2402,2411 ---- } //#2887 var callBack = function(){ ! // Dhn: Modif CAS ! //window.location = "../index.php"; ! window.location= window.casEnabled ? window.casLogoutURI : "../index.php"; ! // Dhn: Modif CAS } saveDataToSession("disconnect", extUrl, null, callBack);/* saveDataToSession("disconnect"+extUrl, "origin=disconnect"); *************** *** 2413,2420 **** load : function(data, args) { if (data) showError(data); ! else ! window.location = "../index.php"; } });/**/ }; --- 2416,2427 ---- load : function(data, args) { if (data) showError(data); ! else { ! // Dhn: Modif CAS ! //window.location = "../index.php"; ! window.location= window.casEnabled ? window.casLogoutURI : "../index.php"; ! // Dhn: Modif CAS ! } } });/**/ }; *************** *** 4567,4570 **** quitConfirmed = true; }; showConfirm(i18n('confirmRedirectionMobile'), redirectMobileFunction); ! } \ No newline at end of file --- 4574,4577 ---- quitConfirmed = true; }; showConfirm(i18n('confirmRedirectionMobile'), redirectMobileFunction); ! } ============view/main.php========== *** view/main.php.orig 2017-11-10 13:55:12.000000000 +0100 --- view/main.php 2017-11-23 15:16:18.000000000 +0100 *************** *** 96,101 **** --- 96,110 ----