I'm just starting out with Neo4j and I struggle a bit on the folling case. Given the following graph:
As "theo", I want to return the list of other user names who can also manage glossaries. Being member of a parent group should give you access to the same permissions as your children.
For example, for "theo", we should return sara and bob as sara is member of PoleManager which is a parent of ProjectManager group. Bob is member of ProjectManager group which have permission to manage glossaries.
So far I have the following query but it does not return sara as a candidate:
MATCH (me:User{name:"theo"})-[:MEMBER_OF]->(g:Group),
(g)-[:CAN_MANAGE]->(Asset{name:"Glossaries"}),
(users:User)-[:MEMBER_OF]->(g)
RETURN me.name AS Me, collect(users.name) AS Users
UNION MATCH (me:User{name:"theo"})-[:MEMBER_OF]->(Group)<-[:CHILD_OF*]-(children:Group),
(children)-[:CAN_MANAGE]->(Asset{name:"Glossaries"}),
(users:User)-[:MEMBER_OF]->(children)
RETURN me.name AS Me, collect(users.name) AS Users
I'm also open to better ideas to represent this graph.
