START u=node:Users("email:ha...@hogwarts.com"), f=node:Folders("uid:child")return sec_rel, length(u-[*0..len]-()-[r]-()) as distance
MATCH p = allShortestPaths(u-[*]->f)
WITH head(filter(r in relationships(p) : type(r) = 'SECURITY')) as sec_rel, length(p) as len
Hi,
I'm a newbie here, and I'm experimenting with using neo4j for an access control list. There's lots of great documentation that has helped me get this far. Thank you.
It turns out that the security relationship in a hierarchical relationship can nearly always be represented by the closest Security relationship.
START u=node:Users("email:ha...@hogwarts.com"), f=node:Folders("uid:child")
MATCH p = allShortestPaths(u-[*]->f)
RETURN filter(r in relationships(p) : type(r) = 'SECURITY')
But sometimes, there is more than one route between the user and folder that is the same length. For this, I need a bit more information to resolve the tie. One example is below, where the user is granted read access on a parent folder, but the read permission has been revoked for a group that the user is a member of in a child folder. In this case, I need to know the distance that the security relationship is from the folder. In this case, the security relationship from the group to the child is closer than the security relationship from the user to the parent. How can I get this distance in the cypher query?
Thanks in advance!
Matt--
could you try to look for the path between the user and the security relationship, and return them together with the length of that path (ordered by distance)
START u=node:Users("email...@hogwarts.com"), f=node:Folders("uid:child")
MATCH p = allShortestPaths(u-[*]->f)
WITH head(filter(r in relationships(p) : type(r) = 'SECURITY')) as sec_rel, length(p) as len
return sec_rel, length(u-[*0..len]-()-[r]-()) as distance
order by distance ascMichael
Am 17.09.2012 um 20:14 schrieb Matt Jones:
Hi,
I'm a newbie here, and I'm experimenting with using neo4j for an access control list. There's lots of great documentation that has helped me get this far. Thank you.
It turns out that the security relationship in a hierarchical relationship can nearly always be represented by the closest Security relationship.
START u=node:Users("email...@hogwarts.com"), f=node:Folders("uid:child")
--
--