Skip to content
Permalink
Browse files
Bug fix in resource fetch permission inheritance through parent entity
  • Loading branch information
isururanawaka committed Sep 9, 2021
1 parent 260e084 commit 859c873955e9ae3d34cd559be1ace8723918ce11
Showing 1 changed file with 4 additions and 2 deletions.
@@ -83,10 +83,12 @@ public void fetchResource(ResourceFetchRequest request, StreamObserver<ResourceF

String query = " MATCH (u:User), (r" + type + ") where u.username = $username AND u.tenantId = $tenantId AND " +
" r.entityId = $entityId AND r.tenantId = $tenantId" +
" OPTIONAL MATCH (g:Group)<-[:MEMBER_OF]-(u) " +
" OPTIONAL MATCH (g:Group)<-[:MEMBER_OF]-(u) " +
" OPTIONAL MATCH (cg:Group)-[:CHILD_OF]->(g)" +
" OPTIONAL MATCH (r)-[:CHILD_OF*]->(x:COLLECTION)" +
" return case when exists((u)<-[:SHARED_WITH]-(r)) OR exists((g)<-[:SHARED_WITH]-(r)) OR " +
"exists((cg)<-[:SHARED_WITH]-(r)) then r else NULL end as value";
"exists((cg)<-[:SHARED_WITH]-(r)) OR exists((u)<-[:SHARED_WITH]-(x)) OR exists((g)<-[:SHARED_WITH]-(x)) OR exists((cg)<-[:SHARED_WITH]-(x))" +
"then r else NULL end as value";

logger.debug("Fetch resource query {}", query);

0 comments on commit 859c873

Please sign in to comment.