nexus3-oss icon indicating copy to clipboard operation
nexus3-oss copied to clipboard

When updating a user via setup_users_from_list, not all fields are updated

Open tallandtree opened this issue 4 years ago • 1 comments

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)

tallandtree avatar Mar 09 '20 14:03 tallandtree

The same is true for setup_roles_from list.

tallandtree avatar Mar 09 '20 14:03 tallandtree