diff --git a/src/Service/EnforcementManager.php b/src/Service/EnforcementManager.php index a442f690..214a059e 100644 --- a/src/Service/EnforcementManager.php +++ b/src/Service/EnforcementManager.php @@ -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(); @@ -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