You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
=== Privileges for non-existing labels, relationship types, and property names
282
+
283
+
Privileges for non-existent labels, relationship types, and property names have an effect only once the latter are created.
284
+
In other words, when authorizing a user, only privileges for existing labels, relationship types, and property names are applied.
285
+
This is because the graph elements must be resolved internally to be able to check against the privileges when users try to use them later.
286
+
If a label, relationship type, or property name does not yet exist, it will not resolve, and therefore, the privileges will not apply.
287
+
288
+
A way around this is to create the label, relationship type, or property name using the `db.createLabel()`, `db.createRelationshipType()`, and `db.createProperty()` procedures on the relevant database when creating the privileges.
289
+
290
+
Labels, relationship types, and property names are considered non-existent in a database if:
291
+
292
+
* There has never been a node with that label, a relationship with that relationship type, or a property with that name.
293
+
* There has been no attempt to add a node with that label, a relationship with that relationship type, or a property with that name. +
294
+
The attempted creation adds it to the known labels, relationship types, and property names even if the creation itself fails (unless it fails on missing or denied privileges to create new labels, relationship types, or property names).
295
+
* They have not been created using any of the `db.createLabel()`, `db.createRelationshipType()`, or `db.createProperty()` procedures.
296
+
297
+
There is currently no way to remove a label, relationship type, or property name from the database.
298
+
Once existent in the database, they cannot return to non-existent.
299
+
300
+
For example, let's assume that you have a new, freshly-created empty database, called `testing`, and a user named `Alice` with a `custom` role.
301
+
[NOTE]
302
+
=====
303
+
The example focuses only on nodes and their labels, though the same principle applies to relationships and their relationship type, and properties (on both nodes and relationships) and their names.
304
+
=====
305
+
306
+
Using the following command, you define some privileges to the `custom` role:
307
+
[source, cypher]
308
+
----
309
+
GRANT MATCH {*} ON GRAPH testing NODES * TO custom
310
+
GRANT CREATE ON GRAPH testing NODES `A` TO custom
311
+
GRANT SET LABEL `A` ON GRAPH testing TO custom
312
+
GRANT CREATE NEW NODE LABEL ON DATABASE testing TO custom
313
+
----
314
+
315
+
This means that when `Alice` executes:
316
+
317
+
[source, cypher]
318
+
----
319
+
CREATE (:`A`)
320
+
----
321
+
322
+
She will get the following exception even though she is allowed to create new labels:
323
+
[source]
324
+
----
325
+
Create node with labels 'A' on database 'testing' is not allowed for user 'Alice' with roles [PUBLIC, custom].
326
+
----
327
+
328
+
However, rerunning the same query will create the node.
329
+
This is because the failed creation still creates the label, making it no longer non-existent when the query is run a second time.
330
+
331
+
To ensure success on the first attempt, when setting up the privileges for the `custom` role, the administrator should run the `db.createLabel()` procedure on the affected databases for all non-existing labels that get assigned privileges.
332
+
In this example, when creating the custom role, connect to `testing` and run `CALL db.createLabel('A')` to ensure Alice creates the node successfully on her first attempt.
Copy file name to clipboardExpand all lines: modules/ROOT/pages/authentication-authorization/privileges-reads.adoc
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,12 @@ For example, we can disable users with the role `regularUsers` from finding all
67
67
DENY TRAVERSE ON HOME GRAPH NODES Payments TO regularUsers
68
68
----
69
69
70
+
[NOTE]
71
+
====
72
+
If a label or a relationship type does not exist in the database, the user cannot use the corresponding privilege until it is created.
73
+
See xref:authentication-authorization/limitations.adoc#access-control-limitations-non-existing-labels[Privileges for non-existing labels, relationship types, and property names] for more information.
74
+
====
75
+
70
76
71
77
[[access-control-privileges-reads-read]]
72
78
== The `READ` privilege
@@ -122,6 +128,12 @@ The following example shows how to do that:
122
128
DENY READ { secret } ON GRAPH neo4j NODES Post TO regularUsers
123
129
----
124
130
131
+
[NOTE]
132
+
====
133
+
If a label, a relationship type, or a property name does not exist in the database, the user cannot use the corresponding privilege until it is created.
134
+
See xref:authentication-authorization/limitations.adoc#access-control-limitations-non-existing-labels[Privileges for non-existing labels, relationship types, and property names] for more information.
135
+
====
136
+
125
137
126
138
[[access-control-privileges-reads-match]]
127
139
== The `MATCH` privilege
@@ -182,3 +194,9 @@ The following query exemplifies how it would look if you wanted to deny both rea
182
194
----
183
195
DENY MATCH { * } ON GRAPH neo4j NODES Account TO regularUsers
184
196
----
197
+
198
+
[NOTE]
199
+
====
200
+
If a label, a relationship type, or a property name does not exist in the database, the user cannot use the corresponding privilege until it is created.
201
+
See xref:authentication-authorization/limitations.adoc#access-control-limitations-non-existing-labels[Privileges for non-existing labels, relationship types, and property names] for more information.
Copy file name to clipboardExpand all lines: modules/ROOT/pages/authentication-authorization/privileges-writes.adoc
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,6 +82,12 @@ If the user attempts to create nodes with a label that does not already exist on
82
82
The same applies to new relationships: the xref:authentication-authorization/database-administration.adoc#access-control-database-administration-tokens[`CREATE NEW RELATIONSHIP TYPE`] privilege is required.
83
83
====
84
84
85
+
[NOTE]
86
+
====
87
+
If a label or a relationship type does not exist in the database, the user cannot use the corresponding privilege until it is created.
88
+
See xref:authentication-authorization/limitations.adoc#access-control-limitations-non-existing-labels[Privileges for non-existing labels, relationship types, and property names] for more information.
89
+
====
90
+
85
91
86
92
[[access-control-privileges-writes-delete]]
87
93
== The `DELETE` privilege
@@ -135,6 +141,12 @@ Users with `DELETE` privilege, but restricted `TRAVERSE` privileges, will not be
135
141
See href:tutorial/access-control.adoc#detach-delete-restricted-user[delete restricted user] for more info.
136
142
====
137
143
144
+
[NOTE]
145
+
====
146
+
If a label or a relationship type does not exist in the database, the user cannot use the corresponding privilege until it is created.
147
+
See xref:authentication-authorization/limitations.adoc#access-control-limitations-non-existing-labels[Privileges for non-existing labels, relationship types, and property names] for more information.
148
+
====
149
+
138
150
139
151
[[access-control-privileges-writes-set-label]]
140
152
== The `SET LABEL` privilege
@@ -181,6 +193,12 @@ DENY SET LABEL foo ON GRAPH * TO regularUsers
181
193
If no instances of this label exist on the database, then the xref:authentication-authorization/database-administration.adoc#access-control-database-administration-tokens[`CREATE NEW LABEL`] privilege is also required.
182
194
====
183
195
196
+
[NOTE]
197
+
====
198
+
If a label does not exist in the database, the user cannot use the corresponding privilege until it is created.
199
+
See xref:authentication-authorization/limitations.adoc#access-control-limitations-non-existing-labels[Privileges for non-existing labels, relationship types, and property names] for more information.
200
+
====
201
+
184
202
185
203
[[access-control-privileges-writes-remove-label]]
186
204
== The `REMOVE LABEL` privilege
@@ -222,6 +240,12 @@ For example, denying the role `regularUsers` the ability to remove the label `fo
222
240
DENY REMOVE LABEL foo ON GRAPH * TO regularUsers
223
241
----
224
242
243
+
[NOTE]
244
+
====
245
+
If a label does not exist in the database, the user cannot use the corresponding privilege until it is created.
246
+
See xref:authentication-authorization/limitations.adoc#access-control-limitations-non-existing-labels[Privileges for non-existing labels, relationship types, and property names] for more information.
247
+
====
248
+
225
249
226
250
[[access-control-privileges-writes-set-property]]
227
251
== The `SET PROPERTY` privilege
@@ -273,6 +297,12 @@ DENY SET PROPERTY { foo } ON GRAPH * NODES bar TO regularUsers
273
297
If the user attempts to set a property with a property name that does not already exist on the database, the user must also possess the xref:authentication-authorization/database-administration.adoc#access-control-database-administration-tokens[`CREATE NEW PROPERTY NAME`] privilege.
274
298
====
275
299
300
+
[NOTE]
301
+
====
302
+
If a label, a relationship type, or a property name does not exist in the database, the user cannot use the corresponding privilege until it is created.
303
+
See xref:authentication-authorization/limitations.adoc#access-control-limitations-non-existing-labels[Privileges for non-existing labels, relationship types, and property names] for more information.
xref:authentication-authorization/database-administration.adoc#access-control-database-administration-tokens[`CREATE NEW PROPERTY NAME`] privileges are required.
312
342
====
313
343
344
+
[NOTE]
345
+
====
346
+
If a label, a relationship type, or a property name does not exist in the database, the user cannot use the corresponding privilege until it is created.
347
+
See xref:authentication-authorization/limitations.adoc#access-control-limitations-non-existing-labels[Privileges for non-existing labels, relationship types, and property names] for more information.
0 commit comments