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@googlemail.com>2014-05-29 04:45:06 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-05-29 04:45:06 +0400
commit82da315ea28b6ac1b94f3bc683bc0c8f29756fce (patch)
tree7830306d3c2c52ef8ce89af922e3d78090784fd6 /core/Settings
parent62acfde14e6c514b6a5008c9f6aaa284b01db44b (diff)
refs #5212 added possibility to make a system setting readable for non super users
Diffstat (limited to 'core/Settings')
-rw-r--r--core/Settings/Setting.php17
-rw-r--r--core/Settings/SystemSetting.php11
-rw-r--r--core/Settings/UserSetting.php3
3 files changed, 26 insertions, 5 deletions
diff --git a/core/Settings/Setting.php b/core/Settings/Setting.php
index c36aa24653..3e0d5d0d63 100644
--- a/core/Settings/Setting.php
+++ b/core/Settings/Setting.php
@@ -145,7 +145,8 @@ abstract class Setting
protected $key;
protected $name;
- protected $displayedForCurrentUser = false;
+ protected $writableByCurrentUser = false;
+ protected $readableByCurrentUser = false;
/**
* @var StorageInterface
@@ -181,9 +182,19 @@ abstract class Setting
*
* @return bool
*/
- public function canBeDisplayedForCurrentUser()
+ public function isWritableByCurrentUser()
{
- return $this->displayedForCurrentUser;
+ return $this->writableByCurrentUser;
+ }
+
+ /**
+ * Returns `true` if this setting can be displayed for the current user, `false` if otherwise.
+ *
+ * @return bool
+ */
+ public function isReadableByCurrentUser()
+ {
+ return $this->readableByCurrentUser;
}
/**
diff --git a/core/Settings/SystemSetting.php b/core/Settings/SystemSetting.php
index 9a731bb855..8ca6a347cc 100644
--- a/core/Settings/SystemSetting.php
+++ b/core/Settings/SystemSetting.php
@@ -23,6 +23,14 @@ use Piwik\Piwik;
class SystemSetting extends Setting
{
/**
+ * By default the value of the system setting is only readable by SuperUsers but someone the value should be
+ * readable by everyone.
+ *
+ * @var bool
+ */
+ public $readableByCurrentUser = false;
+
+ /**
* Constructor.
*
* @param string $name The persisted name of the setting.
@@ -32,7 +40,8 @@ class SystemSetting extends Setting
{
parent::__construct($name, $title);
- $this->displayedForCurrentUser = Piwik::hasUserSuperUserAccess();
+ $this->writableByCurrentUser = Piwik::hasUserSuperUserAccess();
+ $this->readableByCurrentUser = $this->writableByCurrentUser;
}
/**
diff --git a/core/Settings/UserSetting.php b/core/Settings/UserSetting.php
index caeb918e71..5d23a5bd51 100644
--- a/core/Settings/UserSetting.php
+++ b/core/Settings/UserSetting.php
@@ -35,7 +35,8 @@ class UserSetting extends Setting
$this->setUserLogin($userLogin);
- $this->displayedForCurrentUser = Piwik::isUserHasSomeViewAccess();
+ $this->writableByCurrentUser = Piwik::isUserHasSomeViewAccess();
+ $this->readableByCurrentUser = Piwik::isUserHasSomeViewAccess();
}
/**