ENHANCEMENT: Let LeftAndMain subclass canView() methods optionally redirect. (from r90018)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@96800 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-01-13 00:03:18 +00:00
parent 58534f76c5
commit 0ee53df7a6

View File

@ -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;