diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index 08e22b51..c4ee1816 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -118,7 +118,8 @@ class LeftAndMain extends Controller { } // Allow customisation of the access check by a decorator - if(!$this->canView()) { + // Also all the canView() check to execute Director::redirect() + if(!$this->canView() && !$this->response->isFinished()) { // When access /admin/, we should try a redirect to another part of the admin rather than be locked out $menu = $this->MainMenu(); foreach($menu as $candidate) { @@ -145,7 +146,7 @@ class LeftAndMain extends Controller { return Security::permissionFailure($this, $messageSet); } - + // Don't continue if there's already been a redirection request. if(Director::redirected_to()) return;