Skip to content

Commit

Permalink
0026947: Open Slate: Logout
Browse files Browse the repository at this point in the history
  • Loading branch information
smeyer-ilias committed Jan 9, 2020
1 parent a7674d1 commit 609cd8e
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 32 deletions.
4 changes: 3 additions & 1 deletion Services/Init/classes/class.ilInitialisation.php
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,7 @@ protected static function abortAndDie($a_message)
{
if (is_object($GLOBALS['ilLog'])) {
$GLOBALS['ilLog']->write("Fatal Error: ilInitialisation - " . $a_message);
$GLOBALS['ilLog']->logStack();
}
die($a_message);
}
Expand Down Expand Up @@ -1821,7 +1822,8 @@ protected static function blockedAuthentication($a_current_script)
if (
$cmd == "showTermsOfService" || $cmd == "showClientList" ||
$cmd == 'showAccountMigration' || $cmd == 'migrateAccount' ||
$cmd == 'processCode' || $cmd == 'showLoginPage' || $cmd == 'doStandardAuthentication' || $cmd == 'doCasAuthentication'
$cmd == 'processCode' || $cmd == 'showLoginPage' || $cmd == 'showLogout' ||
$cmd == 'doStandardAuthentication' || $cmd == 'doCasAuthentication'
) {
ilLoggerFactory::getLogger('auth')->debug('Blocked authentication for cmd: ' . $cmd);
return true;
Expand Down
78 changes: 49 additions & 29 deletions Services/Init/classes/class.ilStartUpGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1242,16 +1242,58 @@ protected function doMigration()
}
}

/**
* Show logout screen
*/
protected function showLogout()
{
global $DIC;

$lng = $DIC->language();
$ilIliasIniFile = $DIC['ilIliasIniFile'];

$tpl = self::initStartUpTemplate("tpl.logout.html");

$client_id = $_GET['client_id'];

if (ilPublicSectionSettings::getInstance()->isEnabledForDomain($_SERVER['SERVER_NAME'])) {
$tpl->setCurrentBlock("homelink");
$tpl->setVariable("CLIENT_ID", "?client_id=" . $client_id . "&lang=" . $lng->getLangKey());
$tpl->setVariable("TXT_HOME", $lng->txt("home"));
$tpl->parseCurrentBlock();
}

if ($ilIliasIniFile->readVariable("clients", "list")) {
$tpl->setCurrentBlock("client_list");
$tpl->setVariable("TXT_CLIENT_LIST", $lng->txt("to_client_list"));
$this->ctrl->setParameter($this, "client_id", $client_id);
$tpl->setVariable(
"CMD_CLIENT_LIST",
$this->ctrl->getLinkTarget($this, "showClientList")
);
$tpl->parseCurrentBlock();
$this->ctrl->setParameter($this, "client_id", "");
}

$tpl->setVariable("TXT_PAGEHEADLINE", $lng->txt("logout"));
$tpl->setVariable("TXT_LOGOUT_TEXT", $lng->txt("logout_text"));
$tpl->setVariable("TXT_LOGIN", $lng->txt("login_to_ilias"));
$tpl->setVariable("CLIENT_ID", "?client_id=" . $client_id . "&lang=" . $lng->getLangKey());

self::printToGlobalTemplate($tpl);
}



/**
* show logout screen
*/
public function showLogout()
public function doLogout()
{
global $DIC;

$ilSetting = $DIC->settings();
$user = $DIC->user();
$lng = $DIC->language();
$ilIliasIniFile = $DIC['ilIliasIniFile'];
$ilAppEventHandler = $DIC['ilAppEventHandler'];
Expand All @@ -1264,6 +1306,8 @@ public function showLogout()
]
);

$user_language = $user->getLanguage();

ilSession::setClosingContext(ilSession::SESSION_CLOSE_USER);
$GLOBALS['DIC']['ilAuthSession']->logout();

Expand All @@ -1283,34 +1327,10 @@ public function showLogout()
$this->ctrl->redirectToURL('saml.php?action=logout&logout_url=' . urlencode(ILIAS_HTTP_PATH . '/login.php'));
}

//instantiate logout template
$tpl = self::initStartUpTemplate("tpl.logout.html");

if (ilPublicSectionSettings::getInstance()->isEnabledForDomain($_SERVER['SERVER_NAME'])) {
$tpl->setCurrentBlock("homelink");
$tpl->setVariable("CLIENT_ID", "?client_id=" . $client_id . "&lang=" . $lng->getLangKey());
$tpl->setVariable("TXT_HOME", $lng->txt("home"));
$tpl->parseCurrentBlock();
}

if ($ilIliasIniFile->readVariable("clients", "list")) {
$tpl->setCurrentBlock("client_list");
$tpl->setVariable("TXT_CLIENT_LIST", $lng->txt("to_client_list"));
$this->ctrl->setParameter($this, "client_id", $client_id);
$tpl->setVariable(
"CMD_CLIENT_LIST",
$this->ctrl->getLinkTarget($this, "showClientList")
);
$tpl->parseCurrentBlock();
$this->ctrl->setParameter($this, "client_id", "");
}

$tpl->setVariable("TXT_PAGEHEADLINE", $lng->txt("logout"));
$tpl->setVariable("TXT_LOGOUT_TEXT", $lng->txt("logout_text"));
$tpl->setVariable("TXT_LOGIN", $lng->txt("login_to_ilias"));
$tpl->setVariable("CLIENT_ID", "?client_id=" . $client_id . "&lang=" . $lng->getLangKey());

self::printToGlobalTemplate($tpl);
// redirect and show logout information
$this->ctrl->setParameter($this, 'client_id', $client_id);
$this->ctrl->setParameter($this, 'lang', $user_language);
$this->ctrl->redirect($this, 'showLogout');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ protected function deleteOwnAccountLogout()

$ilUser->activateDeletionFlag();

// see ilStartupGUI::showLogout()
// see ilStartupGUI::doLogout()
ilSession::setClosingContext(ilSession::SESSION_CLOSE_USER);
$GLOBALS['DIC']['ilAuthSession']->logout();

Expand Down
2 changes: 1 addition & 1 deletion logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
ilInitialisation::initILIAS();

$ilCtrl->initBaseClass("ilStartUpGUI");
$ilCtrl->setCmd("showLogout");
$ilCtrl->setCmd('doLogout');
$ilCtrl->callBaseClass();
$ilBench->save();

Expand Down

0 comments on commit 609cd8e

Please sign in to comment.