diff options
author | d-skora <d.skora@clearcode.cc> | 2014-05-20 13:36:23 +0400 |
---|---|---|
committer | d-skora <d.skora@clearcode.cc> | 2014-05-20 13:36:23 +0400 |
commit | 2ac4f79f5cbf892f09701eb0154c194609387421 (patch) | |
tree | 109801b5be5c6d71c9d05157788f63c542920f9a /plugins/SegmentEditor/API.php | |
parent | db037d6c63451385170f5acd778250319de60dfb (diff) |
PIWIK-767 cleanup after review
Diffstat (limited to 'plugins/SegmentEditor/API.php')
-rw-r--r-- | plugins/SegmentEditor/API.php | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/plugins/SegmentEditor/API.php b/plugins/SegmentEditor/API.php index f2a4d075bc..3911e9f9db 100644 --- a/plugins/SegmentEditor/API.php +++ b/plugins/SegmentEditor/API.php @@ -112,17 +112,16 @@ class API extends \Piwik\Plugin\API } } - protected function checkUserCanEditSegment($siteid = false) { if($this->isUserCanEditSegment($siteid) == false) { - throw new Exception("You don't have the required access level to do this."); + throw new Exception(Piwik::translate('SegmentEditor_YouDontHaveAccessToCreateSegments')); } } public function isUserCanEditSegment($siteid = false) { - $requiredAccess = isset(Config::getInstance()->General['segment_editor_required_access']) ? Config::getInstance()->General['segment_editor_required_access'] : "view"; + $requiredAccess = Config::getInstance()->General['segment_editor_required_access']; return ($this->checkSuperAdminAccess($requiredAccess) || $this->checkViewAccess($requiredAccess, $siteid) || @@ -131,34 +130,19 @@ class API extends \Piwik\Plugin\API private function checkSuperAdminAccess($requiredAccess) { - if ($requiredAccess == 'superadmin' && Piwik::hasUserSuperUserAccess()) { - return true; - } - return false; + return ($requiredAccess == 'superadmin' && Piwik::hasUserSuperUserAccess()); } private function checkViewAccess($requiredAccess, $siteid) { - if ( - $requiredAccess == 'view' && ( - Piwik::isUserHasViewAccess($siteid) || ($siteid === 0 && Piwik::isUserHasSomeViewAccess()) - ) - ) { - return true; - } - return false; + return ($requiredAccess == 'view' && ( + Piwik::isUserHasViewAccess($siteid) || ($siteid === 0 && Piwik::isUserHasSomeViewAccess()))); } private function checkAdminAccess($requiredAccess, $siteid) { - if ( - $requiredAccess == 'admin' && ( - Piwik::isUserHasAdminAccess($siteid) || ($siteid === 0 && Piwik::isUserHasSomeAdminAccess()) - ) - ) { - return true; - } - return false; + return ($requiredAccess == 'admin' && ( + Piwik::isUserHasAdminAccess($siteid) || ($siteid === 0 && Piwik::isUserHasSomeAdminAccess()))); } protected function checkUserCanModifySegment($segment) |