Move methods that verify user permissions from Piwik into another class #6585
Labels
c: Platform
For Matomo platform changes that aren't impacting any of our APIs but improve the core itself.
duplicate
For issues that already existed in our issue tracker and were reported previously.
Task
Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Milestone
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 theCommon
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
orAccess
. If the name of the class was something likeUser
the methods could be named likegetCurrentLogin
,checkHasSomeAdminAcccess
,hasSomeAdminAccess
etc. Probably we even have to split some methods into multiple classes. EgdoAsSuperUser
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.
The text was updated successfully, but these errors were encountered: