Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@gmail.com>2015-12-10 03:47:03 +0300
committermattab <matthieu.aubry@gmail.com>2015-12-21 12:11:33 +0300
commit69bc09673c96ac6317df541df12e86584aaa1761 (patch)
tree8fa2246957a18b7b2e0f1ea4c226cebbc1c6570b /tests/PHPUnit/Framework/Mock
parent401489f1056119ae4c74b35f2c5040d60e800714 (diff)
fixes #4314 Don't let "admin" users see all other users in Piwik
Diffstat (limited to 'tests/PHPUnit/Framework/Mock')
-rw-r--r--tests/PHPUnit/Framework/Mock/FakeAccess.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/PHPUnit/Framework/Mock/FakeAccess.php b/tests/PHPUnit/Framework/Mock/FakeAccess.php
index 7cd1691639..e23ceb2148 100644
--- a/tests/PHPUnit/Framework/Mock/FakeAccess.php
+++ b/tests/PHPUnit/Framework/Mock/FakeAccess.php
@@ -128,7 +128,7 @@ class FakeAccess extends Access
public function checkUserHasSomeViewAccess()
{
if (!self::$superUser) {
- if (count(self::$idSitesView) == 0) {
+ if (count(array_merge(self::$idSitesView, self::$idSitesAdmin)) == 0) {
throw new NoAccessException("checkUserHasSomeViewAccess Fake exception // string not to be tested");
}
} else {
@@ -137,14 +137,20 @@ class FakeAccess extends Access
}
//means at least view access
+ public function isUserHasSomeAdminAccess()
+ {
+ if (self::$superUser) {
+ return true;
+ }
+
+ return count(self::$idSitesAdmin) > 0;
+ }
+
+ //means at least view access
public function checkUserHasSomeAdminAccess()
{
- if (!self::$superUser) {
- if (count(self::$idSitesAdmin) == 0) {
- throw new NoAccessException("checkUserHasSomeAdminAccess Fake exception // string not to be tested");
- }
- } else {
- return; //Super User has some admin rights
+ if (!$this->isUserHasSomeAdminAccess()) {
+ throw new NoAccessException("checkUserHasSomeAdminAccess Fake exception // string not to be tested");
}
}