@d-skora opened this Pull Request on May 13th 2014

Please, review.
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).

@mattab commented on May 14th 2014 Member

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

@d-skora commented on May 15th 2014

Ok, I've created a feature request here http://dev.piwik.org/trac/ticket/5172
I hope I've filled the form fields correctly.

Additional notes:
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).

@mattab commented on May 21st 2014 Member

Very useful new feature, thank you for the pull request Daniel! Fixes #5172

@mattab commented on May 22nd 2014 Member

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

See http://dev.piwik.org/trac/ticket/5172#comment:4

This Pull Request was closed on May 21st 2014
Powered by GitHub Issue Mirror