Check one list against another and return boolean

H All,

I need to check one array against another in neo4j. Basically I am trying to check the permission against which user inherit from his role or group

match (u:user)-[:MEMBER_OF]->(r:role) where u.uid = 46713
with u as usr, r as rol
match (usr)-[mog:MEMBER_OF_GROUP | CREATED_GROUP]->(g:group)
with usr, rol, g, mog
call apoc.when(mog.inherit = true, "RETURN rol as val", "RETURN mog as val", {mog:mog, rol:rol})
YIELD value
with value,g
match (g)-[can:CAN_ACCESS]->(n) where n.name = "hello"
with can, value as v, g
call apoc.when(size(can.directoryPermission) > 0, "RETURN can.directoryPermission as directoryPermission", "RETURN can.documentPermission as documentPermission", {can:can})
YIELD value
with value as entityPermission, v as permissions
return entityPermission, permissions
  • CAN_ACCESS -> can have either documentPermission property or directoryPermission

result ->

need to check this entityPermission with permission.

thanks
Meet