Skip to content

Commit

Permalink
WAC: Fix issue with denied requests for resources when requesting log… (
Browse files Browse the repository at this point in the history
ILIAS-eLearning#3642)

* WAC: Fix issue with denied requests for resources when requesting login page after logout

* WAC: Fix issue with denied requests for resources when requesting login page after logout
  • Loading branch information
mjansenDatabay authored and chfsx committed Sep 24, 2021
1 parent 87bf5eb commit e4a1148
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions Services/WebAccessChecker/classes/class.ilWebAccessChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,28 @@ public function initILIAS()
protected function checkPublicSection()
{
global $DIC;
$not_on_login_page = $this->isRequestNotFromLoginPage();
$on_login_page = !$this->isRequestNotFromLoginPage();
$is_anonymous = ((int) $DIC->user()->getId() === (int) ANONYMOUS_USER_ID);
$is_null_user = ($DIC->user()->getId() === 0);
$pub_section_activated = (bool) $DIC['ilSetting']->get('pub_section');
$isset = isset($DIC['ilSetting']);
$instanceof = $DIC['ilSetting'] instanceof ilSetting;
if (!$isset || !$instanceof || (!$pub_section_activated && ($is_anonymous || ($is_null_user && $not_on_login_page)))) {

if (!$isset || !$instanceof) {
throw new ilWACException(ilWACException::ACCESS_DENIED_NO_PUB);
}

if ($on_login_page && ($is_null_user || $is_anonymous)) {
// Request is initiated from login page
return;
}

if ($pub_section_activated && ($is_null_user || $is_anonymous)) {
// Request is initiated from an enabled public area
return;
}

if ($is_anonymous || $is_null_user) {
throw new ilWACException(ilWACException::ACCESS_DENIED_NO_PUB);
}
}
Expand Down

0 comments on commit e4a1148

Please sign in to comment.