nexus3-oss
nexus3-oss copied to clipboard
When updating a user via setup_users_from_list, not all fields are updated
Nexus OSS version: 3.21.1-01.
When I try to change the first name, last name, status or description of an existing user via setup_users_from_list, the user fields are not actually changed in nexus.
I think this is caused by the org.sonatype.nexus.security.user.User.equals
and org.sonatype.nexus.security.user.User.compareTo
operators, that both only check userId and source.
In groovy, == translates to compareTo if objects are comparable and to equals if not. In both cases only userId and source are checked for comparison.
I've solved it by removing the check:
if (user != security.securitySystem.getUser(userDef.username))
Also user status is not updated. This can be solved by adding something like:
status = userDef.status == 'active' ? UserStatus.active:UserStatus.disabled
user.setStatus(status)
The same is true for setup_roles_from list.