diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-05-29 04:45:06 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-05-29 04:45:06 +0400 |
commit | 82da315ea28b6ac1b94f3bc683bc0c8f29756fce (patch) | |
tree | 7830306d3c2c52ef8ce89af922e3d78090784fd6 /core/Settings | |
parent | 62acfde14e6c514b6a5008c9f6aaa284b01db44b (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.php | 17 | ||||
-rw-r--r-- | core/Settings/SystemSetting.php | 11 | ||||
-rw-r--r-- | core/Settings/UserSetting.php | 3 |
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(); } /** |