@Override
@POST
public UserResourceResponse put(Context context, Request request, Response response, Object payload)
throws ResourceException
{
UserResourceRequest resourceRequest = (UserResourceRequest) payload;
UserResourceResponse result = null;
if (resourceRequest != null) {
UserResource resource = resourceRequest.getData();
// the password can not be set on update, The only way to set a password is using the users_setpw resource
if (StringUtils.isNotEmpty(resource.getPassword())) {
throw new PlexusResourceException(
Status.CLIENT_ERROR_BAD_REQUEST,
this.getErrorResponse("*",
"Updating a users password using this URI is not allowed."));
}
try {
User user = restToSecurityModel(getSecuritySystem().getUser(resource.getUserId()), resource);
validateUserContainment(user);
getSecuritySystem().updateUser(user);
result = new UserResourceResponse();
result.setData(resourceRequest.getData());
result.getData().setResourceURI(createChildReference(request, resource.getUserId()).toString());
}
catch (InvalidConfigurationException e) {