Skip to content
Snippets Groups Projects
Commit 8c385edb authored by Peter Rotich's avatar Peter Rotich Committed by Peter Rotich
Browse files

Add bootstrap::signal function to connect to system-wide signals of interest

Connect to logout signal and clear upgrader session on staff logout.
parent 7770208a
No related branches found
No related tags found
No related merge requests found
...@@ -48,6 +48,20 @@ class Bootstrap { ...@@ -48,6 +48,20 @@ class Bootstrap {
$_SERVER['REMOTE_ADDR'] = ''; $_SERVER['REMOTE_ADDR'] = '';
} }
/*
* Glue to global signals we're interested in
*/
static function signals() {
//Clear upgrader session on logout.
Signal::connect('auth.logout', function ($user, $data=null) {
if (!$user) return;
if ($user instanceof Staff)
$_SESSION['ost_upgrader'] = null;
});
}
function https() { function https() {
return return
(isset($_SERVER['HTTPS']) (isset($_SERVER['HTTPS'])
......
...@@ -303,6 +303,7 @@ abstract class StaffAuthenticationBackend extends AuthenticationBackend { ...@@ -303,6 +303,7 @@ abstract class StaffAuthenticationBackend extends AuthenticationBackend {
$staff->getUserName(), $staff->getUserName(),
$_SERVER['REMOTE_ADDR'])); //Debug. $_SERVER['REMOTE_ADDR'])); //Debug.
Signal::send('auth.logout', $staff);
} }
static function getUser() { static function getUser() {
......
...@@ -26,6 +26,7 @@ Bootstrap::defineTables(TABLE_PREFIX); ...@@ -26,6 +26,7 @@ Bootstrap::defineTables(TABLE_PREFIX);
Bootstrap::i18n_prep(); Bootstrap::i18n_prep();
Bootstrap::loadCode(); Bootstrap::loadCode();
Bootstrap::connect(); Bootstrap::connect();
Bootstrap::signals();
if(!($ost=osTicket::start()) || !($cfg = $ost->getConfig())) if(!($ost=osTicket::start()) || !($cfg = $ost->getConfig()))
Bootstrap::croak('Unable to load config info from DB. Get tech support.'); Bootstrap::croak('Unable to load config info from DB. Get tech support.');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment