/* see superclass */
  @Override
  public UserRole getApplicationRoleForToken(String authToken) throws Exception {

    if (authToken == null) {
      throw new LocalException(
          "Attempt to access a service without an authorization token, the user is likely not logged in.");
    }
    String parsedToken = authToken.replace("\"", "");
    String username = getUsernameForToken(parsedToken);
    // check for null username
    if (username == null) {
      throw new LocalException("Unable to find user for the authorization token");
    }
    User user = getUser(username.toLowerCase());
    if (user == null) {
      return UserRole.VIEWER;
      // throw new
      // LocalException("Unable to obtain user information for username = " +
      // username);
    }
    return user.getApplicationRole();
  }
  /**
   * Auth helper.
   *
   * @param authUser the auth user
   * @return the user
   * @throws Exception the exception
   */
  private User authHelper(User authUser) throws Exception {
    if (authUser == null) return null;

    // check if authenticated user matches one of our users
    UserList userList = getUsers();
    User userFound = null;
    for (User user : userList.getObjects()) {
      if (user.getUserName().equals(authUser.getUserName())) {
        userFound = user;
        break;
      }
    }

    // if user was found, update to match settings
    if (userFound != null) {
      Logger.getLogger(getClass()).info("Update user = "******"Add user = "******"User = " + authUser.getUserName());

    authUser.setAuthToken(token);
    return authUser;
  }