mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

dugan
01.15.2007 571884cec31d00f0c1b9de186fb1bbac17d289d5
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciHandler.java
@@ -97,6 +97,12 @@
   */
  static AttributeType debugSearchIndex;
  /**
   * Attribute type corresponding to the "ref" attribute type. Used in the
   * search reference access check.
   */
  static AttributeType refAttrType;
 /*
  * DN corresponding to "debugsearchindex" attribute type.
  */
@@ -149,6 +155,14 @@
       DirectoryServer.
               getDefaultAttributeType(EntryContainer.ATTR_DEBUG_SEARCH_INDEX);
     }
     if((refAttrType =
             DirectoryServer.
                     getAttributeType(ATTR_REFERRAL_URL)) == null) {
       refAttrType =
               DirectoryServer.
                       getDefaultAttributeType(ATTR_REFERRAL_URL);
     }
     try {
       debugSearchIndexDN=DN.decode("cn=debugsearch");
     } catch (DirectoryException ex) {
@@ -1232,26 +1246,39 @@
         new AciLDAPOperationContainer(operation, e, (ACI_READ | ACI_EXT_OP));
      ret=accessAllowed(operationContainer);
    }
    if(operation.getRequestOID().equals(OID_PROXIED_AUTH_V2) ||
            operation.getRequestOID().equals(OID_PROXIED_AUTH_V1))
       operation.
              setAttachment(ORIG_AUTH_ENTRY, operation.getAuthorizationEntry());
    return ret;
  }
  //Not planned to be implemented methods.
   /**
  /**
   * {@inheritDoc}
   */
  @Override
  public boolean maySend(SearchOperation operation,
      SearchResultReference reference) {
    //TODO: Deferred.
    return true;
  public boolean maySend(DN dn, SearchOperation operation,
                         SearchResultReference reference) {
    boolean ret;
    if(!(ret=skipAccessCheck(operation))) {
      Entry e = new Entry(dn, null, null, null);
      LinkedHashSet<AttributeValue> vals = new LinkedHashSet<AttributeValue>();
      List<String> URLStrings=reference.getReferralURLs();
      //Load the values, a bind rule might want to evaluate them.
      for(String URLString : URLStrings) {
        vals.add(new AttributeValue(refAttrType, URLString));
      }
      Attribute attr =
                     new Attribute(refAttrType, ATTR_REFERRAL_URL, vals);
      e.addAttribute(attr,null);
      SearchResultEntry se=new  SearchResultEntry(e);
      AciLDAPOperationContainer operationContainer =
              new AciLDAPOperationContainer(operation,
                                           (ACI_READ), se);
      operationContainer.setCurrentAttributeType(refAttrType);
      ret=accessAllowed(operationContainer);
    }
    return ret;
  }
  /**
   * {@inheritDoc}
   */