0
votes

I'm currently analyzing and trying janusgraph for ACL graph. I have configured elasticsearch as index backend. We are extensively using elasticsearch in my company for all the search and analytics puprose already. Now by using janusgraph processing framework, can i do search for certain data or all data while respecting ACL data in single query.

Example graph is below.

g.addV('user').property('userId','u1').property('email','[email protected]').as('u1').
  addV('user').property('userId','u2').property('email','[email protected]').as('u2').
  addV('user').property('userId','u3').property('email','[email protected]').as('u3').
  addV('group').property('groupId','g1').as('g1').
  addV('group').property('groupId','g2').as('g2').
  addV('group').property('groupId','g3').as('g3').
  addV('folder').property('folderId','f1').property('name','folder 1test').property('inheritance',false).as('f1').
  addV('folder').property('folderId','f2').property('name','folder 2test').property('inheritance',true).as('f2').
  addV('folder').property('folderId','f3').property('name','folder 3test').property('inheritance',true).as('f3').
  addV('file').property('fileId','f1').property('title','file title1')
  addE('in_folder').to('f1').
  addE('in_folder').from('f2').to('f1').
  addE('in_folder').from('f3').to('f2').
  addE('member_of').from('u1').to('g1').
  addE('member_of').from('u2').to('g2').
  addE('member_of').from('u3').to('g3').
  addE('member_of').from('g3').to('g1').
  addE('has_permission').from('g1').to('f1').
  addE('has_permission').from('u2').to('f1').iterate()

example use-case , get all folder nodes where user1 have access to? there will be lot more complex queries, aggregations, partial text searches, regular expressions, predictions, etc of elastic features.

I want to know thoughts on whether janusgraph & gremlin can replace direct calls to elastic index. what are the possible ways i can attempt solve search use cases while respecting ACL with the same query ?

1

1 Answers

1
votes

to get all the folders a user has access to you can do:

g.V().has('user', 'userId', 'user1').emit().repeat(out('member_of'))
.out('has_permission').emit().repeat(__.in('in_folder').has('inheritance',true))

Using elastic search capabilities, you can find all the folders any user with, for example, email starting with 'u' and ending with "@fake.com":

g.V().hasLabel('user').has('email',textContainsRegex("u.*@fake.com")).emit().repeat(out('member_of'))
.out('has_permission').emit().repeat(__.in('in_folder').has('inheritance',true))

Check out the JanusGraph documentation for all the available search predicates