Cannot Change password in groovy script

1
0
-1

Hello,
im trying to Change the Password of a user in a groovy script. I try to Change my own Password and im Administrator.
When i read the Password (before change) of the user object, Password ist empty.
Then i create an updateDescriptor and set new firstname and new Password and i update the user with this descriptor. After updateUser new firstname ist correct but Password is empty.

When i take a look in the updateDescriptor string representation (see below) everything seems ok. But the user Password is not updated.

... and i have no idea why. I checked it also in the database and the field is empty.

final UserUpdater updateDescriptor = new UserUpdater();
User currentUser = BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId);
log.severe ("OLD PASSWORD:" + apiAccessor.getIdentityAPI().getUser(currentUser.getId()).password);
updateDescriptor.setPassword("xxx");
updateDescriptor.setFirstName("Doris");
log.severe ("UpdateDescriptor: " + updateDescriptor.toString());
apiAccessor.getIdentityAPI().updateUser(currentUser.getId(), updateDescriptor)
log.severe ("NEW PASSWORD:" + apiAccessor.getIdentityAPI().getUser(currentUser.getId()).password);

UserUpdater{fields={FIRST_NAME=Doris, PASSWORD=xxx}, persoContactUpdater=null, proContactUpdater=null}

Perhaps anyone have an idea what im doing wrong.

Thanks,
Boris

2 answers

1
0
-1

Hi,
thanks for your answer, i also think thats not a Problem of the Code snippet, but ive no idea what the Problem is. Located is my Code in the operations part of a execution tab. I have the newest community Version with mySQL, but i have the Problem also in Studio (on the same machine). :-( Is it the Location of the Code snippet?

When i take a look in the mySQL database, the Password field is completely empty after run and i cannot Login with any Password.
Is perhaps there any encryption Settings missing in my config files or something else?

Is there any other Chance to make Password changes? We Need it for a flow, that users can Change their Password.

Many thanks,
Boris

Comments

Submitted by Lionel Palacin on Fri, 09/08/2017 - 19:54

Do you have the same issue on the Studio? The studio is using a H2 database.

Submitted by Lionel Palacin on Fri, 09/08/2017 - 19:57

Also make sure you follow the recommendation regarding MySql from the documentation: https://documentation.bonitasoft.com/?page=database-configuration

Submitted by be@somax.de on Fri, 09/08/2017 - 21:11

Yes, same issue in Studio. Fields (Firstname, Lastname) are changed correctly, but not the Password. Completely empty.

Submitted by be@somax.de on Fri, 09/08/2017 - 21:12

And no error in logs or anywhere else.

1
0
-1

Hi,

I tried your code and it works fine on my side.

The only thing is the password is not displayed on the logs but the password is still modified. Not sure why the logs is not displayed.

Cheers

Notifications