Author: kwright
Date: Sun Feb 23 13:46:13 2014
New Revision: 1571011

URL: http://svn.apache.org/r1571011
Log:
Fix for CONNECTORS-886.

Modified:
    manifoldcf/integration/elasticsearch/trunk/CHANGES.txt
    manifoldcf/integration/elasticsearch/trunk/README.txt
    
manifoldcf/integration/elasticsearch/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizer.java
    
manifoldcf/integration/elasticsearch/trunk/src/test/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerTest.java

Modified: manifoldcf/integration/elasticsearch/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/manifoldcf/integration/elasticsearch/trunk/CHANGES.txt?rev=1571011&r1=1571010&r2=1571011&view=diff
==============================================================================
--- manifoldcf/integration/elasticsearch/trunk/CHANGES.txt (original)
+++ manifoldcf/integration/elasticsearch/trunk/CHANGES.txt Sun Feb 23 13:46:13 
2014
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 1.2-SNAPSHOT =====================
 
+CONNECTORS-886: Add support for parent security.  This
+change requires reindexing of all content supported by this plugin.
+(Karl Wright)
+
 ======================= Release 1.1 =====================
 
 Add functionality making the plugin compatible with multi-domain

Modified: manifoldcf/integration/elasticsearch/trunk/README.txt
URL: 
http://svn.apache.org/viewvc/manifoldcf/integration/elasticsearch/trunk/README.txt?rev=1571011&r1=1571010&r2=1571011&view=diff
==============================================================================
--- manifoldcf/integration/elasticsearch/trunk/README.txt (original)
+++ manifoldcf/integration/elasticsearch/trunk/README.txt Sun Feb 23 13:46:13 
2014
@@ -16,8 +16,16 @@
 Compatibility
 ------------
 
-This version of this component is fully functional with Apache ManifoldCF 1.5 
and
-above.  It is backwards compatible with earlier versions as well.
+This version of this component is fully functional with Apache ManifoldCF 1.6 
and
+above.  It is backwards compatible with earlier versions as well, except for 
the fact
+that two additional ElasticSearch fields are required for this plugin to work.
+
+Upgrading
+---------
+If you are replacing a version of Apache ManifoldCF Plugin for ElasticSearch 
that is
+older than version 1.2, you must declare two additional fields (representing 
parent
+acls and parent deny acls), and reindex all your documents.  Otherwise, the 
plugin
+will prevent you from viewing any documents.
 
 Instructions for Building Apache ManifoldCF Plugin for Elastic Search from 
Source
 -----------------------------------------------------------------------------

Modified: 
manifoldcf/integration/elasticsearch/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizer.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/integration/elasticsearch/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizer.java?rev=1571011&r1=1571010&r2=1571011&view=diff
==============================================================================
--- 
manifoldcf/integration/elasticsearch/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizer.java
 (original)
+++ 
manifoldcf/integration/elasticsearch/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizer.java
 Sun Feb 23 13:46:13 2014
@@ -62,6 +62,8 @@ public class MCFAuthorizer
   protected final String authorityBaseURL;
   protected final String fieldAllowDocument;
   protected final String fieldDenyDocument;
+  protected final String fieldAllowParent;
+  protected final String fieldDenyParent;
   protected final String fieldAllowShare;
   protected final String fieldDenyShare;
   protected final int connectionTimeout;
@@ -79,6 +81,8 @@ public class MCFAuthorizer
     fieldDenyDocument = cp.denyFieldPrefix+"document";
     fieldAllowShare = cp.allowFieldPrefix+"share";
     fieldDenyShare = cp.denyFieldPrefix+"share";
+    fieldAllowParent = cp.allowFieldPrefix+"parent";
+    fieldDenyParent = cp.denyFieldPrefix+"parent";
     connectionTimeout = cp.connectionTimeout;
     socketTimeout = cp.socketTimeout;
     poolSize = cp.connectionPoolSize;
@@ -179,6 +183,8 @@ public class MCFAuthorizer
     
     FilterBuilder allowShareOpen = new 
TermFilterBuilder(fieldAllowShare,NOSECURITY_TOKEN);
     FilterBuilder denyShareOpen = new 
TermFilterBuilder(fieldDenyShare,NOSECURITY_TOKEN);
+    FilterBuilder allowParentOpen = new 
TermFilterBuilder(fieldAllowParent,NOSECURITY_TOKEN);
+    FilterBuilder denyParentOpen = new 
TermFilterBuilder(fieldDenyParent,NOSECURITY_TOKEN);
     FilterBuilder allowDocumentOpen = new 
TermFilterBuilder(fieldAllowDocument,NOSECURITY_TOKEN);
     FilterBuilder denyDocumentOpen = new 
TermFilterBuilder(fieldDenyDocument,NOSECURITY_TOKEN);
     
@@ -191,6 +197,8 @@ public class MCFAuthorizer
       // have the SolrConnector inject a special token into these fields when 
they otherwise would be empty, and we can trivially match on that token.
       bq.must(allowShareOpen);
       bq.must(denyShareOpen);
+      bq.must(allowParentOpen);
+      bq.must(denyParentOpen);
       bq.must(allowDocumentOpen);
       bq.must(denyDocumentOpen);
     }
@@ -199,6 +207,7 @@ public class MCFAuthorizer
       // Extend the query appropriately for each user access token.
       
bq.must(calculateCompleteSubquery(fieldAllowShare,fieldDenyShare,allowShareOpen,denyShareOpen,userAccessTokens));
       
bq.must(calculateCompleteSubquery(fieldAllowDocument,fieldDenyDocument,allowDocumentOpen,denyDocumentOpen,userAccessTokens));
+      
bq.must(calculateCompleteSubquery(fieldAllowParent,fieldDenyParent,allowParentOpen,denyParentOpen,userAccessTokens));
     }
 
     return bq;

Modified: 
manifoldcf/integration/elasticsearch/trunk/src/test/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerTest.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/integration/elasticsearch/trunk/src/test/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerTest.java?rev=1571011&r1=1571010&r2=1571011&view=diff
==============================================================================
--- 
manifoldcf/integration/elasticsearch/trunk/src/test/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerTest.java
 (original)
+++ 
manifoldcf/integration/elasticsearch/trunk/src/test/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerTest.java
 Sun Feb 23 13:46:13 2014
@@ -188,14 +188,18 @@ public class MCFAuthorizerTest
         "allow_token_document", "token2",
         "deny_token_document", "__nosecurity__",
         "allow_token_share", "__nosecurity__",
-        "deny_token_share", "__nosecurity__"
+        "deny_token_share", "__nosecurity__",
+        "allow_token_parent", "__nosecurity__",
+        "deny_token_parent", "__nosecurity__"
       );
       addDoc("da13-dd3",
         "allow_token_document", "token1",
         "allow_token_document", "token3",
         "deny_token_document", "token3",
         "allow_token_share", "__nosecurity__",
-        "deny_token_share", "__nosecurity__"
+        "deny_token_share", "__nosecurity__",
+        "allow_token_parent", "__nosecurity__",
+        "deny_token_parent", "__nosecurity__"
       );
       addDoc("sa123-sd13",
         "allow_token_share", "token1",
@@ -204,20 +208,26 @@ public class MCFAuthorizerTest
         "deny_token_share", "token1",
         "deny_token_share", "token3",
         "allow_token_document", "__nosecurity__",
-        "deny_token_document", "__nosecurity__"
+        "deny_token_document", "__nosecurity__",
+        "allow_token_parent", "__nosecurity__",
+        "deny_token_parent", "__nosecurity__"
       );
       addDoc("sa3-sd1-da23",
         "allow_token_document", "token2",
         "allow_token_document", "token3",
         "allow_token_share", "token3",
         "deny_token_share", "token1",
-        "deny_token_document", "__nosecurity__"
+        "deny_token_document", "__nosecurity__",
+        "allow_token_parent", "__nosecurity__",
+        "deny_token_parent", "__nosecurity__"
       );
       addDoc("notoken",
         "allow_token_document", "__nosecurity__",
         "deny_token_document", "__nosecurity__",
         "allow_token_share", "__nosecurity__",
-        "deny_token_share", "__nosecurity__"
+        "deny_token_share", "__nosecurity__",
+        "allow_token_parent", "__nosecurity__",
+        "deny_token_parent", "__nosecurity__"
       );
     }
     commit();
@@ -264,8 +274,10 @@ public class MCFAuthorizerTest
       .startObject("properties");
     addField(builder,"allow_token_document");
     addField(builder,"allow_token_share");
+    addField(builder,"allow_token_parent");
     addField(builder,"deny_token_document");
     addField(builder,"deny_token_share");
+    addField(builder,"deny_token_parent");
     builder.endObject()
       .endObject()
       .endObject();


Reply via email to