@mattab opened this Issue on January 29th 2014 Member
@mattab commented on January 30th 2014 Member

Subset of Blog post for new release:

Breaking API changes

Piwik can now handle an unlimited number of users having Super User access (#2589 #4564). In the past Piwik was limited to one Super User who was defined in the config file. From now on all users with Super User access are defined in the database the same way a regular user is. This brought some API changes but we will stay backward compatible until the first of April 2014. This gives you some time to migrate any custom plugins you may use. Although there is a layer for backward compatibility we recommend to make sure your plugin works with Piwik as soon as possible before April 1st.

List of changes

Deprecated methods

The following methods are deprecated and we recommend to use the new methods from now on. There are also some methods which won't be replaced so make sure to adjust the logic of your plugin.

\Piwik\Piwik::isUserIsSuperUserOrTheUser => \Piwik\Piwik::hasUserSuperUserAccessOrIsTheUser
\Piwik\Piwik::checkUserIsSuperUserOrTheUser => \Piwik\Piwik::checkUserHasSuperUserAccessOrIsTheUser
\Piwik\Piwik::isUserIsSuperUser => \Piwik\Piwik::hasUserSuperUserAccess
\Piwik\Piwik::setUserIsSuperUser => \Piwik\Piwik::setUserHasSuperUserAccess
\Piwik\Piwik::checkUserIsSuperUser => \Piwik\Piwik::checkUserHasSuperUserAccess
\Piwik\Piwik::getSuperUserLogin => No replacement, returns the userLogin of the first Super User we find in the database
\Piwik\Piwik::getSuperUserEmail => No replacement, returns an empty string from now on
\Piwik\Access::isSuperUser => \Piwik\Access::hasSuperUserAccess
\Piwik\Access::checkUserIsSuperUser => \Piwik\Access::checkUserHasSuperUserAccess
\Piwik\Access::getSuperUserLogin => No replacement, returns the userLogin of the first Super User we find in the database
\Piwik\Access::setSuperUser => \Piwik\Access::setSuperUserAccess
\FakeAccess::checkUserIsSuperUser => FakeAccess::checkUserHasSuperUserAccess
\FakeAccess::setSuperUser => FakeAccess::setSuperUserAccess
\FakeAccess::getSuperUserLogin => No replacement

Config Super User

As mentioned, the Super User was defined in the config and you have accessed the Super User's data either by using a convenient method like Piwik::getSuperUserLogin or directly via the Config object as follows:


As the config user is no longer defined in the config this will no longer work in the future. To stay backward compatible we return the first super user found in the database. This is not necessarily always the same user. So if you have used the super user login for instance to identify any entry in the option table like '${superuserlogin}_myoptionname' we recommend to migrate the optionname to 'myoptionname'.

Extended Auth Interface

The last change affects plugins who specifcy their own Authentication mechanism, for instance when using the custom LoginLDAP plugin. From now on the interface \Piwik\Auth (https://github.com/piwik/piwik/blob/master/core/Auth.php) requires the methods setTokenAuth and setLogin. There is no backward compatibility layer but we had a look at some plugins defining a custom Authentication adapter to make sure those methods are already defined there as expected.

After updating the plugin

So you have updated your plugin but this means your plugin will no longer work with previous Piwik versions. Therefore you should define the minimum required version in your plugin.json (http://developer.piwik.org/guides/distributing-your-plugin#getting-your-plugin-ready-to-publish) file as follows:

"require": {
"piwik": ">=2.0.4-b5"

@mattab commented on February 24th 2014 Member

We published a new blog post informing plugin developers of the breaking core API changes in 2.1: http://piwik.org/blog/2014/02/piwik-2-1-changes-plugin-developers/

@mattab commented on February 24th 2014 Member

Added a new user guide at: Managing Super Users

@mattab commented on February 24th 2014 Member
This Issue was closed on February 24th 2014
Powered by GitHub Issue Mirror