class UserRest {

    @PUT
    @Path("{username}/password")
    @RolesAllowed("admin")
    @ApiOperation("Resets a Mobi User's password if User making request is the admin")
    public Response resetPassword(@Context ContainerRequestContext context,
                           @PathParam("username") String username,
                           @QueryParam("newPassword") String newPassword) {
        if (StringUtils.isEmpty(username)) {
            throw ErrorUtils.sendError("Current username must be provided", Response.Status.BAD_REQUEST);
        }
        if (StringUtils.isEmpty(newPassword)) {
            throw ErrorUtils.sendError("New password must be provided", Response.Status.BAD_REQUEST);
        }
        try {
            return changePassword(username, newPassword);
        } catch (IllegalArgumentException ex) {
            throw ErrorUtils.sendError(ex.getMessage(), Response.Status.BAD_REQUEST);
        }
    }

}