Skip to content

Commit

Permalink
Merge pull request #180 from micmania1/fix-unnecessary-redirect
Browse files Browse the repository at this point in the history
FIX: Removed unnecessary redirect.
  • Loading branch information
Damian Mooyman committed Feb 24, 2015
2 parents ebebff2 + 3ca2861 commit 73e0202
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions code/extensions/LeftAndMainSubsites.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,10 @@ public function onBeforeInit() {
// Update current subsite in session
Subsite::changeSubsite($_GET['SubsiteID']);

if ($this->owner->canView(Member::currentUser())) {
//Redirect to clear the current page
return $this->owner->redirect($this->owner->Link());
if (!$this->owner->canView(Member::currentUser())) {
//Redirect to the default CMS section
return $this->owner->redirect('admin/');
}
//Redirect to the default CMS section
return $this->owner->redirect('admin/');
}

// Automatically redirect the session to appropriate subsite when requesting a record.
Expand All @@ -234,12 +232,10 @@ public function onBeforeInit() {
// Update current subsite in session
Subsite::changeSubsite($record->SubsiteID);

if ($this->owner->canView(Member::currentUser())) {
//Redirect to clear the current page
return $this->owner->redirect($this->owner->Link());
if (!$this->owner->canView(Member::currentUser())) {
//Redirect to the default CMS section
return $this->owner->redirect('admin/');
}
//Redirect to the default CMS section
return $this->owner->redirect('admin/');
}

}
Expand Down

0 comments on commit 73e0202

Please sign in to comment.