Skip to content

Commit 1ad904b

Browse files
added relationship as well for the examples covering all nodes
1 parent 68f15bd commit 1ad904b

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

modules/ROOT/pages/authentication-authorization/limitations.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ So due to the additional data access required by the security checks, this opera
390390

391391
[[property-based-access-control-limitations]]
392392
=== Property-based access control limitations
393-
Extra node-level security checks are necessary when adding security rules based on property rules, and these can have a significant performance impact.
393+
Extra element-level security checks are necessary when adding security rules based on property rules, and these can have a significant performance impact.
394394
The following example shows how the database behaves when adding security rules to roles `restricted` and `unrestricted`:
395395

396396
[source, cypher]

modules/ROOT/pages/authentication-authorization/property-based-access-control.adoc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,22 @@ GRANT TRAVERSE ON GRAPH * FOR (n:Email) WHERE n.classification IS NULL TO regula
119119

120120
=== Deny a property-based privilege using a comparison operator
121121

122-
The following example shows how to deny permission to `READ` and `TRAVERSE` nodes where the property `classification` is different from `UNCLASSIFIED` to role `regularUsers`:
122+
The following example shows how to deny permission to `READ` and `TRAVERSE` nodes and relationships where the property `classification` is different from `UNCLASSIFIED` to role `regularUsers`:
123123

124124
[source, syntax, role="noheader"]
125125
----
126126
DENY MATCH {*} ON GRAPH * FOR (n) WHERE n.classification <> 'UNCLASSIFIED' TO regularUsers
127+
DENY MATCH {*} ON GRAPH * FOR ()-[r]-() WHERE r.classification <> 'UNCLASSIFIED' TO regularUsers
127128
----
128129

129130
=== Grant a property-based privilege on all properties using a property value
130131

131-
The following example shows how to grant permission to `READ` all properties on nodes where the property `securityLevel` is higher than `3` to role `regularUsers`:
132+
The following example shows how to grant permission to `READ` all properties on nodes and relationships where the property `securityLevel` is higher than `3` to role `regularUsers`:
132133

133134
[source, syntax, role="noheader"]
134135
----
135136
GRANT READ {*} ON GRAPH * FOR (n) WHERE n.securityLevel > 3 TO regularUsers
137+
GRANT READ {*} ON GRAPH * FOR ()-[r]-() WHERE r.securityLevel > 3 TO regularUsers
136138
----
137139

138140
[NOTE]
@@ -142,22 +144,24 @@ The role `regularUsers` does not need to have `READ` privilege for the property
142144

143145
=== Deny a property-based privilege using a list of values
144146

145-
The following example shows how to deny permission to `READ` all properties on nodes where the property `classification` is not included in the list of `[UNCLASSIFIED, PUBLIC]`:
147+
The following example shows how to deny permission to `READ` all properties on nodes and relationships where the property `classification` is not included in the list of `[UNCLASSIFIED, PUBLIC]`:
146148

147149
[source, syntax, role="noheader"]
148150
----
149151
DENY READ {*} ON GRAPH * FOR (n) WHERE NOT n.classification IN ['UNCLASSIFIED', 'PUBLIC'] TO regularUsers
152+
DENY READ {*} ON GRAPH * FOR ()-[r]-() WHERE NOT r.classification IN ['UNCLASSIFIED', 'PUBLIC'] TO regularUsers
150153
----
151154

152155
// The last two examples were added in 5.26.
153156

154157
=== Grant a property-based privilege using temporal value
155158

156-
The following example shows how to grant permission to `READ` all properties on nodes where the property `createdAt` is later than the current date:
159+
The following example shows how to grant permission to `READ` all properties on nodes and relationships where the property `createdAt` is later than the current date:
157160

158161
[source, syntax, role="noheader"]
159162
----
160163
GRANT READ {*} ON GRAPH * FOR (n) WHERE n.createdAt > date() TO regularUsers
164+
GRANT READ {*} ON GRAPH * FOR ()-[r]-() WHERE r.createdAt > date() TO regularUsers
161165
----
162166

163167
[NOTE]
@@ -184,6 +188,7 @@ SHOW ROLE regularUsers PRIVILEGES AS REVOKE COMMANDS
184188
|===
185189
|command
186190
|"REVOKE GRANT READ {*} ON GRAPH * FOR (n) WHERE n.createdAt > date('2024-10-25') FROM `regularUsers`"
187-
a|Rows: 1
191+
|"REVOKE GRANT READ {*} ON GRAPH * FOR ()-[r]-() WHERE r.createdAt > date('2024-10-25') FROM `regularUsers`"
192+
a|Rows: 2
188193
|===
189194

0 commit comments

Comments
 (0)