From 4f0d8c135f207b0bbf7b7878a59395a8b07efbeb Mon Sep 17 00:00:00 2001
From: Thomas Steur <thomas.steur@gmail.com>
Date: Thu, 14 Nov 2013 04:23:22 +0000
Subject: [PATCH] make sure the user has access to the website. otherwise if
 access to website was removed we would still redirect to this website where
 user would see an error

---
 core/Plugin/Controller.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/core/Plugin/Controller.php b/core/Plugin/Controller.php
index 9f71d873d5..3bf738b395 100644
--- a/core/Plugin/Controller.php
+++ b/core/Plugin/Controller.php
@@ -735,7 +735,9 @@ abstract class Controller
             $defaultWebsiteId = $defaultReport;
         }
 
-        if ($defaultWebsiteId) {
+        ;
+
+        if ($defaultWebsiteId && Piwik::isUserHasViewAccess($defaultWebsiteId)) {
             return $defaultWebsiteId;
         }
 
-- 
GitLab