-
Notifications
You must be signed in to change notification settings - Fork 83
Example of property-based access control using temporal value #1887
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
Changes from 4 commits
8abf3aa
1ce97a7
1796982
3f3369a
363a703
c912b3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,4 +97,33 @@ 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`: | ||
| [source, syntax, role="noheader"] | ||
| ---- | ||
| GRANT READ {*} ON GRAPH * FOR (n) WHERE n.createdAt > date() TO regularUsers | ||
| ---- | ||
| [NOTE] | ||
| ==== | ||
| The `date()` function is evaluated, and the value used to evaluate the privilege is the date when the property-based privilege is created. | ||
| Keep this in mind when designing your property rules, and use the `SHOW PRIVILEGES AS COMMANDS` command to check the stored value. | ||
| This is essential when revoking property-based privileges containing evaluated function values like `date()`. | ||
| ==== | ||
| [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]. | ||
| ==== | ||
|
|
||
| .Show the privilege created by the command in the example above as a revoke command: | ||
HannesSandberg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| [source, syntax, role="noheader"] | ||
| ---- | ||
| SHOW ROLE regularUsers PRIVILEGES AS REVOKE COMMANDS | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there's a lot of things granted to that role but if this page isn't being tested I guess just returning the one you want to show is fine 🤷 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, I did want to show the explicit case and not everything that was granted to the role |
||
| ---- | ||
| .Result | ||
| [options="header,footer", width="100%", cols="m"] | ||
| |=== | ||
| |command | ||
| |"REVOKE GRANT READ {*} ON GRAPH * FOR (n) WHERE n.createdAt > date('2024-10-25') FROM `regularUsers`" | ||
| a|Rows: 1 | ||
| |=== | ||
Uh oh!
There was an error while loading. Please reload this page.