jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Mueller (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OAK-1083) Query with descendent node and access control fails to return result
Date Mon, 14 Oct 2013 08:36:41 GMT

    [ https://issues.apache.org/jira/browse/OAK-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13793988#comment-13793988
] 

Thomas Mueller commented on OAK-1083:
-------------------------------------

This is a bit tricky. When I patch the query engine like this (making the above test case
work):

{code}
--- src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java	(revision 1531812)
+++ src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java	(working copy)
@@ -266,11 +266,7 @@
         while (cursor != null && cursor.hasNext()) {
             scanCount++;
             currentRow = cursor.next();
-            Tree tree = getTree(currentRow.getPath());
-            if (tree == null || !tree.exists()) {
-                continue;
-            }
-            if (!matchesAllTypes && !evaluateTypeMatch(tree)) {
+            if (!matchesAllTypes && !evaluateTypeMatch()) {
                 continue;
             }
             if (selectorCondition != null && !selectorCondition.evaluate()) {
@@ -286,7 +282,11 @@
         return false;
     }
 
-    private boolean evaluateTypeMatch(Tree tree) {
+    private boolean evaluateTypeMatch() {
+        Tree tree = getTree(currentRow.getPath());
+        if (tree == null || !tree.exists()) {
+            return false;
+        }
         PropertyState primary = tree.getProperty(JCR_PRIMARYTYPE);
         if (primary != null && primary.getType() == NAME) {
             String name = primary.getValue(NAME);
{code}

then the following QueryTest fails:

{code}
        // verify we can not deduce existence of the invisible node
        // using a join
        q = testSession.getWorkspace().getQueryManager().createQuery(
                "select a.* from [nt:base] as a " +
                "inner join [nt:base] as b on isdescendantnode(b, a) " +
                "where a.[jcr:path]=$path", Query.JCR_SQL2);
        q.bindValue("path", vf.createValue(visible.getPath()));
        r = q.execute();
        assertFalse(r.getNodes().hasNext());
{code}


> Query with descendent node and access control fails to return result
> --------------------------------------------------------------------
>
>                 Key: OAK-1083
>                 URL: https://issues.apache.org/jira/browse/OAK-1083
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core, security
>    Affects Versions: 0.9
>            Reporter: Chetan Mehrotra
>            Priority: Minor
>              Labels: compatibility
>         Attachments: OAK-1083-testcase.patch
>
>
> The scenario is bit complex. Running a query with following condition does not give any
result
> *  Node path is like {{/home/users/geometrixx-outdoors/emily.andrews@mailinator.com/social/relationships/following/aaron.mcdonald@mailinator.com}}
> * It has a Glob jcr:read for everyone at {{\*/social/relationships/following/\*}}
> * The query is like 
> bq. /jcr:root/home//social/relationships/following//*[id='aaron.mcdonald@mailinator.com']
> * The query is executed with anonymous session
> On JR2 it returns expected result while on Oak it does not give any result



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message