Exemplo n.º 1
0
  /** {@inheritDoc} */
  @Override
  public boolean maySend(DN dn, Operation operation, SearchResultReference reference) {
    boolean ret;
    if (!(ret = skipAccessCheck(operation))) {
      Entry e = new Entry(dn, null, null, null);
      AttributeBuilder builder = new AttributeBuilder(refAttrType, ATTR_REFERRAL_URL);
      List<String> URLStrings = reference.getReferralURLs();

      // Load the values, a bind rule might want to evaluate them.
      for (String URLString : URLStrings) {
        builder.add(AttributeValues.create(refAttrType, URLString));
      }

      e.addAttribute(builder.toAttribute(), null);
      SearchResultEntry se = new SearchResultEntry(e);
      AciLDAPOperationContainer operationContainer =
          new AciLDAPOperationContainer(operation, (ACI_READ), se);
      operationContainer.setCurrentAttributeType(refAttrType);
      ret = accessAllowed(operationContainer);
    }
    return ret;
  }
Exemplo n.º 2
0
 /**
  * Check access on compare operations. Note that the attribute type is unavailable at this time,
  * so this method partially parses the raw attribute string to get the base attribute type.
  * Options are ignored.
  *
  * @param operation The compare operation to check access on.
  * @return True if access is allowed.
  */
 @Override
 public boolean isAllowed(LocalBackendCompareOperation operation) {
   AciLDAPOperationContainer operationContainer =
       new AciLDAPOperationContainer(operation, ACI_COMPARE);
   String baseName;
   String rawAttributeType = operation.getRawAttributeType();
   int semicolonPosition = rawAttributeType.indexOf(';');
   if (semicolonPosition > 0) {
     baseName = toLowerCase(rawAttributeType.substring(0, semicolonPosition));
   } else {
     baseName = toLowerCase(rawAttributeType);
   }
   AttributeType attributeType;
   if ((attributeType = DirectoryServer.getAttributeType(baseName)) == null) {
     attributeType = DirectoryServer.getDefaultAttributeType(baseName);
   }
   AttributeValue attributeValue =
       AttributeValues.create(attributeType, operation.getAssertionValue());
   operationContainer.setCurrentAttributeType(attributeType);
   operationContainer.setCurrentAttributeValue(attributeValue);
   return isAllowed(operationContainer, operation);
 }