Ejemplo n.º 1
0
  /**
   * Attempts to drop a User object with the specified name from this object's set.
   *
   * <p>A successful drop action consists of:
   *
   * <p>
   *
   * <UL>
   *   <LI>removing the User object with the specified name from the set.
   *   <LI>revoking all rights from the removed User<br>
   *       (this ensures that in case there are still references to the just dropped User object,
   *       those references cannot be used to erronously access database objects).
   * </UL>
   *
   * <p>
   */
  public void dropUser(String name) {

    boolean reservedUser = GranteeManager.isReserved(name);

    if (reservedUser) {
      throw Error.error(ErrorCode.X_28502, name);
    }

    boolean result = granteeManager.removeGrantee(name);

    if (!result) {
      throw Error.error(ErrorCode.X_28501, name);
    }

    User user = (User) userList.remove(name);

    if (user == null) {
      throw Error.error(ErrorCode.X_28501, name);
    }
  }