@PreAuthorize("hasRole('" + StandardEntitlement.USER_UPDATE + "')")
@Override
public ProvisioningResult<UserTO> assign(
final String key,
final Collection<String> resources,
final boolean changepwd,
final String password,
final boolean nullPriorityAsync) {
UserTO user = binder.getUserTO(key);
Set<String> effectiveRealms = RealmUtils.getEffective(
AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_UPDATE),
user.getRealm());
securityChecks(effectiveRealms, user.getRealm(), user.getKey());
UserPatch patch = new UserPatch();
patch.setKey(key);
patch.getResources().addAll(resources.stream().map(resource
-> new StringPatchItem.Builder().operation(PatchOperation.ADD_REPLACE).value(resource).build()).
collect(Collectors.toList()));
if (changepwd) {
patch.setPassword(new PasswordPatch.Builder().
value(password).onSyncope(false).resources(resources).build());
}
return update(patch, nullPriorityAsync);
}