Skip to content
Permalink
Browse files
Merge pull request #66 from isururanawaka/sharing_service_impl
Bug fix in resource fetch permission inheritance through parent entity
  • Loading branch information
isururanawaka committed Sep 9, 2021
2 parents 1d4d432 + 859c873 commit 58590f34d9c2269d1d0cec43783daf4b9e50ea3d
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 58590f3

Please sign in to comment.