Currently, the Piwik\Piwik class contains many methods to verify user permissions such as
getCurrentUserLogin and many more. Similar to the
Common class it is only a huge collection of random methods that actually do not belong in this class.
It should be rather in a class like
Access. If the name of the class was something like
User the methods could be named like
hasSomeAdminAccess etc. Probably we even have to split some methods into multiple classes. Eg
doAsSuperUser might belong to another class.
Another problem with the current implementation is that the core accesses methods from plugins although the core should be stupid and not know anything about the plugins. Instead an Event or better DI should be used. This will other plugins allow to completely replace this part and we'd have a cleaner core. We might have to create another issue for this as it adds a lot of complexity to this issue.
At the latest this change should be made for Piwik 3.0 but the sooner the better.
:+1: and we can keep BC, like for other refactorings, by keeping the old static methods as proxies to the new class. Using an simple object injectable using DI would make totally sense.