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

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@102663 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-13 03:26:55 +00:00
parent 81f5920228
commit 1dfe8f3a83

View File

@ -125,7 +125,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) {
@ -152,7 +153,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;