Skip to content

Commit

Permalink
Merge pull request #375 from robbieaverill/pulls/4.0/fix-cms-access
Browse files Browse the repository at this point in the history
FIX Members minimal CMS access were previously stuck in a login loop, now redirects to MFA
  • Loading branch information
Garion Herman authored Mar 26, 2020
2 parents 4b97095 + a648e63 commit d839cfb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Service/EnforcementManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,13 @@ public function shouldRedirectToMFA(Member $member): bool
return false;
}

if ($this->config()->get('requires_admin_access') && !$this->hasAdminAccess($member)) {
return false;
if ($this->config()->get('requires_admin_access')) {
$hasAdminAccess = Member::actAs($member, function () use ($member) {
return $this->hasAdminAccess($member);
});
if (!$hasAdminAccess) {
return false;
}
}

$methodRegistry = MethodRegistry::singleton();
Expand Down Expand Up @@ -229,7 +234,7 @@ protected function hasAdminAccess(Member $member): bool
}

// Look through all LeftAndMain subclasses to find if one permits the member to view
$menu = $leftAndMain->MainMenu();
$menu = $leftAndMain->MainMenu(false);
foreach ($menu as $candidate) {
if (
$candidate->Link
Expand Down

0 comments on commit d839cfb

Please sign in to comment.