this.getLogger().warn(e.getMessage(), e);
throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, "User with id '" + userId + "' not found.");
}
// get the dto
UserToRoleResource userToRole = mappingRequest.getData();
Set<RoleIdentifier> roleIdentifiers = this.restToSecurityModel(userToRole);
if (roleIdentifiers.size() == 0) {
throw new PlexusResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Configuration error.",
getErrorResponse("roles", "User requires one or more roles."));
}
try {
// this will throw if we cannot find the user, in that case we will create one.
getSecuritySystem().setUsersRoles(userToRole.getUserId(), userToRole.getSource(), roleIdentifiers);
}
catch (InvalidConfigurationException e) {
this.handleInvalidConfigurationException(e);
}
catch (UserNotFoundException e) {