Database Reference
In-Depth Information
Figure 2.5. Relationships between entities in the access control system
As you can see, there are several possible paths from a User to a Permission . In order
to find out what permissions a user has, you need to find all the Permission nodes that
a User node is connected to, via any path. In a traditional RDBMS, this would require a
complex query expressing the union of each of the different kinds of paths:
• From User directly to Permission (one table join)
• From User to Group to Permission (two table joins)
• From User to Role to Permission (two table joins)
• From User to Group to Role to Permission (three table joins)
In Cypher, a single short query will suffice:
MATCH (u:User)-[*]->(p:Permission)
WHERE u.name = "User name"
RETURN DISTINCT p.name
 
Search WWH ::




Custom Search