Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/segment editor #275

Merged
merged 7 commits into from May 21, 2014
Merged

Conversation

d-skora
Copy link

@d-skora d-skora commented May 13, 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).

@@ -6,6 +6,7 @@
; edit config/config.ini.php and add the following:
; [General]
; action_title_category_delimiter = "-"
; segment_editor_required_access = "admin"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a comment. Instead, put this in the content itself, with proper default value (ie. 'view')

Also add a comment that explains what the setting means, and the possible values

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, should I change it here so it'll be a default value or do You want it to be a configurable option set from a panel in settings? Because I'm not sure what do You mean exactly by content (should it be a default value in global.ini.php, should it be a value in the database, should it be in a Settings class or something else?)

@mattab
Copy link
Member

mattab commented May 14, 2014

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
Copy link
Author

d-skora commented May 15, 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).

@@ -6,6 +6,9 @@
; edit config/config.ini.php and add the following:
; [General]
; action_title_category_delimiter = "-"
; Change the following value to set the required access level for creating, editing and removing segments
; Possible values are "view", "admin" and "superadmin"
segment_editor_required_access = "admin"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move below [General] as it is a setting like the others

@mattab
Copy link
Member

mattab commented May 21, 2014

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

mattab pushed a commit that referenced this pull request May 21, 2014
@mattab mattab merged commit 22227f6 into matomo-org:master May 21, 2014
@mattab
Copy link
Member

mattab commented May 22, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants