@tsteur opened this Issue on November 4th 2014 Owner

Currently, the Piwik\Piwik class contains many methods to verify user permissions such as (check|has|is)(UserHasSuperUserAccess|UserHasSomeAdminAccess), 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 User or Access. If the name of the class was something like User the methods could be named like getCurrentLogin, checkHasSomeAdminAcccess, 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.

@mnapoli commented on November 4th 2014 Member

:+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.

@mattab commented on December 18th 2014 Owner

We'd need to do this before Piwik 3.0.0 #6074

Powered by GitHub Issue Mirror