Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of property-based access control using temporal value #1887

Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,18 @@ The role `regularUsers` does not need to have `READ` privilege for the property
[source, syntax, role="noheader"]
----
DENY READ {*} ON GRAPH * FOR (n) WHERE NOT n.classification IN ['UNCLASSIFIED', 'PUBLIC'] TO regularUsers
----
----

.Granting permission to `READ` all properties on nodes where the property `createdAt` is later than current date to role `regularUsers`:
HannesSandberg marked this conversation as resolved.
Show resolved Hide resolved
[source, syntax, role="noheader"]
----
GRANT READ {*} ON GRAPH * FOR (n) WHERE n.createdAt > date() TO regularUsers
----
[NOTE]
====
The `date()` function will be evaluated and the value used to evaluate the privilege will be the date at the time the property-based privilege was created.
HannesSandberg marked this conversation as resolved.
Show resolved Hide resolved
====
[NOTE]
====
Not all temporal values are comparable, see link:{neo4j-docs-base-uri}/cypher-manual/{page-version}/syntax/operators/#cypher-ordering[Cypher Manual -> Syntax -> Operators -> Ordering and comparison of values].
====