@RequestMapping(value = "/users/{userId}", method = RequestMethod.GET)
  public User userObject(
      @PathVariable("userId") int id, @RequestHeader("x-token") String securitytoken) {
    User user = new User();

    User authUser = userService.pass(securitytoken);

    if (authUser.getId() > 0) {
      user = userService.findById(id);
    }

    return user;
  }
  @RequestMapping(value = "/users/{userId}", method = RequestMethod.DELETE)
  public User userDelete(
      @PathVariable("userId") int id, @RequestHeader("x-token") String securitytoken) {
    User deletedUser = new User();

    User authUser = userService.pass(securitytoken);
    if (authUser.getId() > 0 && authUser.getLevel() > 10) {
      deletedUser = userService.findById(id);

      if (deletedUser.getId() > 0) {
        deletedUser = userService.delete(id);
      }
    }

    return deletedUser;
  }
  @RequestMapping(value = "/users/{userId}", method = RequestMethod.POST)
  public User userUpdate(
      @PathVariable("userId") int id,
      @RequestBody User user,
      @RequestHeader("x-token") String securitytoken) {
    User updatedUser = user;

    User authUser = userService.pass(securitytoken);
    if (authUser.getId() > 0) {
      updatedUser = userService.findById(id);

      if (updatedUser.getId() > 0 && authUser.getLevel() > 0) {
        updatedUser.setLogin(user.getLogin());
        updatedUser.setPasswd(user.getPasswd());
        updatedUser.setFirstName(user.getFirstName());
        updatedUser.setLastName(user.getLastName());
        updatedUser.setLevel(user.getLevel());

        updatedUser = userService.update(updatedUser);
      }
    }

    return updatedUser;
  }