Ejemplo n.º 1
0
  /** Determines whether or not a user has a specified role */
  public boolean hasRole(RoleType role) {
    for (TableProtectionElement tpe : securityRights) {
      if (tpe.hasRole(role)) {
        return true;
      }
    }

    return false;
  }
Ejemplo n.º 2
0
  /**
   * Finds values in authorization data that meet certain criteria.
   *
   * <p>This returns the name of Protection elements like: NCIA.Phantom//WashU-IRL
   *
   * @param tableName - the 'table name' to look for in authorizatoin data
   * @param columnName - the 'column name' to look for in authorizatoin data
   */
  private List<String> findValuesFromAuthorizationData(
      String tableName, String columnName, RoleType role) {

    tableName = NCIAConfig.getProtectionElementPrefix() + tableName;
    columnName = NCIAConfig.getProtectionElementPrefix() + columnName;

    List<String> returnValues = new ArrayList<String>();

    for (TableProtectionElement tpe : securityRights) {
      if (tableName.equals(tpe.getTableName())
          && columnName.equals(tpe.getAttributeName())
          && tpe.hasRole(role)) {

        String value = tpe.getAttributeValue();

        if (value != null) {
          // Strip off the prefix
          returnValues.add(value.replace(NCIAConfig.getProtectionElementPrefix(), ""));
        }
      }
    }

    return returnValues;
  }