diff options
author | diosmosis <benaka@piwik.pro> | 2014-09-10 13:33:37 +0400 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2014-09-10 13:33:37 +0400 |
commit | e79784e0f1274fa76c395e9a84357f7ca3dd6ad6 (patch) | |
tree | 756edc0b30fbcd8b8c42f151f1fb418ac6f52507 /plugins/SegmentEditor/API.php | |
parent | ef61529d414af219e64e42a0578b8df1222d8c5d (diff) |
Fixes #5923, add INI config option allow_adding_segments_for_all_websites that allows users to disable the ability to add segments affecting all websites.
Diffstat (limited to 'plugins/SegmentEditor/API.php')
-rw-r--r-- | plugins/SegmentEditor/API.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/SegmentEditor/API.php b/plugins/SegmentEditor/API.php index 301fe44a50..98b752cc2a 100644 --- a/plugins/SegmentEditor/API.php +++ b/plugins/SegmentEditor/API.php @@ -115,7 +115,13 @@ class API extends \Piwik\Plugin\API protected function checkUserCanAddNewSegment($idSite) { - if(!$this->isUserCanAddNewSegment($idSite)) { + if (empty($idSite) + && !SegmentEditor::isAddingSegmentsForAllWebsitesEnabled() + ) { + throw new Exception(Piwik::translate('SegmentEditor_AddingSegmentForAllWebsitesDisabled')); + } + + if (!$this->isUserCanAddNewSegment($idSite)) { throw new Exception(Piwik::translate('SegmentEditor_YouDontHaveAccessToCreateSegments')); } } |