@mgazdzik opened this issue on October 1st 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 commented on October 2nd 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

@mgazdzik commented on October 2nd 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 commented on October 2nd 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!

This issue was closed on March 14th 2015
Powered by GitHub Issue Mirror