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

Make UsersManager.getSitesAccessFromUser work for SuperUsers #6359

Closed
mgazdzik opened this issue Oct 1, 2014 · 3 comments
Closed

Make UsersManager.getSitesAccessFromUser work for SuperUsers #6359

mgazdzik opened this issue Oct 1, 2014 · 3 comments
Assignees
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Milestone

Comments

@mgazdzik
Copy link
Contributor

mgazdzik commented Oct 1, 2014

I'm wondering is there any particular reason why in method
https://github.com/piwik/piwik/blob/master/plugins/UsersManager/API.php#L239
exception is thrown in case current user is super-admin ?

This is public method, which could be useful for pulling out for example default idSite while configuring some features. However it throws error for SuperUser while it actually should probably return all site ids to which superuser has access ?

In other words - since Piwik allows multiple super-admins, this exception makes this method quite unusable in any further way than it is currently. Maybe it would be worth to change this logic and make method more usable ?

Of course I'm open for discussion if there is any generic way to pull out available idsites based on given user login ?

@mattab
Copy link
Member

mattab commented Oct 2, 2014

That's agood point, this method could be changed to work for Super Users as well.
But instead maybe you can use this API which returns all websites IDs and works for all users including Super Users?
SitesManager.getSitesWithAtLeastViewAccess
or
SitesManager.getSitesIdWithAtLeastViewAccess

reference: http://developer.piwik.org/api-reference/reporting-api#SitesManager

@mattab mattab added the Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. label Oct 2, 2014
@mattab mattab modified the milestones: Long term, Mid term Oct 2, 2014
@mgazdzik
Copy link
Contributor Author

mgazdzik commented Oct 2, 2014

Yes, I agree that this method from SitesManager API does the same job, but my point was that this method in UsersManager acting could be a bit confusing for developers (for example as it was for me ;) ).

I think that in Piwik there should be no confusing methods (or at least keep them to the minimum ;) )

Maybe we could transform this ticket into another easy pick issue to refactor UsersManager method to be working properly with super admin as well ? Easy work, but still some improvement to the platform.

@mattab
Copy link
Member

mattab commented Oct 2, 2014

Yes sounds good, we could return 'admin' flag for all websites for the super user. Feel free to edit the issue, i've added the easy pick!

@mattab mattab added the Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. label Oct 2, 2014
@mattab mattab added the Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. label Oct 11, 2014
@mattab mattab modified the milestones: Mid term, Long term Oct 11, 2014
@sgiehl sgiehl changed the title UsersManager unnecessary exception ? Make UsersManager.getSitesAccessFromUser work for SuperUsers Mar 14, 2015
@sgiehl sgiehl self-assigned this Mar 14, 2015
@sgiehl sgiehl closed this as completed in 3317ff8 Mar 14, 2015
@mattab mattab modified the milestones: Piwik 2.12.0, Long term Mar 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Projects
None yet
Development

No branches or pull requests

3 participants