This branch contains changes in the SegmentEditor plugin that enable setting the access level required to create/edit/remove segments.
It must be set in the config.ini.php under the General values. An example has been added (commented out) in global.ini.php: segment_editor_required_access = "admin".
The possible values for this parameter are: "view", "admin", "superadmin" and are compared to the user's access level to a given siteid.
If there's no siteid given and the user is not a superuser then the user has no access to segment editor, and if the segment is accessible for any site then the user needs the required access level for at least one site.
User always can view segments from the segment selector (given he has some view access).
Thanks for pull request! I put some code review items.
Also could you please create ticket for this feature request in our issue tracker: http://dev.piwik.org/
Looking forward to next version! happy hacking
Ok, I've created a feature request here http://dev.piwik.org/trac/ticket/5172
I hope I've filled the form fields correctly.
I've kept the isset line in the API function isUserCanEditSegment because some tests couldn't find the config value for the required access level (while it worked correctly when testing this manually).
Very useful new feature, thank you for the pull request Daniel! Fixes #5172
I think the Pull request was based off wrong requirements, so I reduced scope of ticket and made some code changes to meet the requirement which was only to "Require given user permission to Create segment (by default any "view" user can create a segment, but this can now be restricted to "admin" or "superuser")
Setting renamed to adding_segment_requires_access