citrix / ShareFile-NET

C# library for accessing ShareFile V3 API
MIT License
36 stars 26 forks source link

Can passwords for Client Accounts be changed via the API? #42

Closed pduer closed 1 year ago

pduer commented 4 years ago

Is it possible to change a password of a Client Account in ShareFile using the API?

If it is, can the Client Account itself change it's own password if so granted those rights?

EmmaGCitrix commented 4 years ago

Yes and yes.

To reset a password:

ODataObject request = new ODataObject();
request.AddProperty("OldPassword", oldPassword); // can be omitted if called by an admin account
request.AddProperty("NewPassword", newPassword);
await SFClient.Users.ResetPassword(clientUser.url, request).ExecuteAsync();

If the client needs to do it, they will need the role CanChangePassword, which you should be able to update like:

await SFClient.Users.UpdateRoles(clientUser.url, new User { Roles = new List<UserRole>() { UserRole.CanChangePassword } }).ExecuteAsync();
pduer commented 1 year ago

Thanks!