I'm wondering is there any particular reason why in method
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 ?
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?
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.
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!