private User updateUserStandard ( LdapName originalId , User existingUser ) { User savedUser = userRepo . save ( existingUser ) ; if ( ! originalId . equals ( savedUser . getId ( ) ) ) { // The user has moved - we need to update group references. LdapName oldMemberDn = toAbsoluteDn ( originalId ) ; LdapName newMemberDn = toAbsoluteDn ( savedUser . getId ( ) ) ; Collection < Group > groups = groupRepo . findByMember ( oldMemberDn ) ; updateGroupReferences ( groups , oldMemberDn , newMemberDn ) ; } return savedUser ; }
Update the user and - if its id changed - update all group references to the user .