diff --git a/API.php b/API.php index 83aac28..45e6089 100644 --- a/API.php +++ b/API.php @@ -431,6 +431,14 @@ protected function checkUserHasWriteAccess($idSite = null) { if ($idSite != false) { Piwik::checkUserHasWriteAccess($idSite); + return; + } + $settings = $this->getPluginSettings(); + $externalShortcodesIdSite = $settings->getSetting(ShortcodeTracker::SHORTENER_EXTERNAL_SHORTCODES_IDSITE)->getValue(); + if ($externalShortcodesIdSite !== null) + { + Piwik::checkUserHasWriteAccess($externalShortcodesIdSite); + return; } Piwik::checkUserHasSuperUserAccess(); } diff --git a/Widgets/GetShortcodegenerator.php b/Widgets/GetShortcodegenerator.php index 19859f2..1455f9d 100644 --- a/Widgets/GetShortcodegenerator.php +++ b/Widgets/GetShortcodegenerator.php @@ -49,7 +49,7 @@ public static function configure(WidgetConfig $config) * $config->setParameters(array('myparam' => 'myvalue')); */ - if (Piwik::isUserHasSomeAdminAccess() === false) { + if (Piwik::isUserHasSomeWriteAccess() === false) { $config->disable(); } /** diff --git a/changelog.md b/changelog.md index a975d65..9568afe 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,6 @@ ## Changelog +* 1.2.1 + * Allow any user with Write permission to generate shortcodes (previously it would require SuperAdmin access) * 1.2.0 * add proper LICENSE file to codebase diff --git a/plugin.json b/plugin.json index de0d96e..1a819e4 100644 --- a/plugin.json +++ b/plugin.json @@ -1,6 +1,6 @@ { "name": "ShortcodeTracker", - "version": "1.2.0", + "version": "1.2.1", "description": "Plugin allowing user to create shortcodes and track their usage within Piwik. Also integrates with UI to deliver user-friendly interaction.", "theme": false, "keywords": [