matomo-org / piwik-dotnet-api

Official C# implementation of the Matomo Analytics API
GNU General Public License v3.0
36 stars 24 forks source link

passwordConfirmation for UsersManager.updateUser #12

Open grzech1983 opened 5 years ago

grzech1983 commented 5 years ago

Hello,

I'm just notifying that from version 3.8.0 of Matomo updating user is not working anymore because of:

https://developer.matomo.org/changelog

Breaking Changes When changing the email address or the password through the UsersManager.updateUser API, a new parameter passwordConfirmation needs to be sent along with the request containing the current password of the user issuing the API request.

and since API is not using any credentials at all only token then IMHO is not usable in current state.

Adding new user using addUser is also needing new param: initialIdSite

- UsersManager.addUser (userLogin, password, email, alias = '', initialIdSite = '') [ No example available ]

Thanks

Fensterbank commented 5 years ago

@grzech1983 What do you mean it is not usable? The library method or the API method itself? The library could be easily updated.

Concerning your second point, did you saw any issues when initialIdSite is not passed? And do you have any idea, what it is doing? There is no documentation. :(

This is how our code is implemented.

int[] idSites = { piwikSiteId };
var password = Membership.GeneratePassword(16, 3);
response = usersManager.addUser(piwikUserName, password, piwikUserEmail);
if (!response["result"].Equals("success"))
{
  throw new OperationCanceledException($"Unable to create piwik user. Received status: {response["result"]}");
}

response = usersManager.setUserAccess(piwikUserName, UsersManager.UserAccess.view, idSites);

We did not saw any issues, but I confirm it makes sense to update the library.