Write privileges
Write privileges are defined for different parts of the graph:
-
CREATE- allows creating nodes and relationships. -
DELETE- allows deleting nodes and relationships. -
SET LABEL- allows setting the specified node labels using theSETclause. -
REMOVE LABEL- allows removing the specified node labels using theREMOVEclause. -
SET PROPERTY- allows setting properties on nodes and relationships.
There are also compound privileges which combine the above specific privileges:
-
MERGE- allows match, create and set property to permit theMERGEcommand. -
WRITE- allows all write operations on an entire graph. -
ALL GRAPH PRIVILEGES- allows all read and write operation on an entire graph.
The CREATE privilege
The CREATE privilege allows a user to create new node and relationship elements in a graph.
See the Cypher® CREATE clause.
GRANT CREATE ON {DEFAULT GRAPH | GRAPH[S] { * | name[, ...] }}
[
ELEMENT[S] { * | label-or-rel-type[, ...] }
| NODE[S] { * | label[, ...] }
| RELATIONSHIP[S] { * | rel-type[, ...] }
]
TO role[, ...]
For example, granting the ability to create elements on the graph neo4j to the role regularUsers would be achieved using:
GRANT CREATE ON GRAPH neo4j ELEMENTS * TO regularUsers
0 rows, System updates: 2
The CREATE privilege can also be denied.
DENY CREATE ON {DEFAULT GRAPH | GRAPH[S] { * | name[, ...] }}
[
ELEMENT[S] { * | label-or-rel-type[, ...] }
| NODE[S] { * | label[, ...] }
| RELATIONSHIP[S] { * | rel-type[, ...] }
]
TO role[, ...]
For example, denying the ability to create nodes with the label foo on all graphs to the role regularUsers would be achieved using:
DENY CREATE ON GRAPH * NODES foo TO regularUsers
0 rows, System updates: 1
|
If the user attempts to create nodes with a label that does not already exist in the database, then the user must also possess the CREATE NEW LABEL privilege. The same applies to new relationships - the CREATE NEW RELATIONSHIP TYPE privilege is required. |
The DELETE privilege
The DELETE privilege allows a user to delete node and relationship elements in a graph.
See the Cypher DELETE clause.
GRANT DELETE ON {DEFAULT GRAPH | GRAPH[S] { * | name[, ...] }}
[
ELEMENT[S] { * | label-or-rel-type[, ...] }
| NODE[S] { * | label[, ...] }
| RELATIONSHIP[S] { * | rel-type[, ...] }
]
TO role[, ...]
For example, granting the ability to delete elements on the graph neo4j to the role regularUsers would be achieved using:
GRANT DELETE ON GRAPH neo4j ELEMENTS * TO regularUsers
0 rows, System updates: 2
The DELETE privilege can also be denied.
DENY DELETE ON {DEFAULT GRAPH | GRAPH[S] { * | name[, ...] }}
[
ELEMENT[S] { * | label-or-rel-type[, ...] }
| NODE[S] { * | label[, ...] }
| RELATIONSHIP[S] { * | rel-type[, ...] }
]
TO role[, ...]
For example, denying the ability to delete relationships with the relationship type bar on all graphs to the role regularUsers would be achieved using:
DENY DELETE ON GRAPH * RELATIONSHIPS bar TO regularUsers
0 rows, System updates: 1
|
Users with |
The SET LABEL privilege
The SET LABEL privilege allows you to set labels on a node using the SET clause.
GRANT SET LABEL { * | label[, ...] }
ON {DEFAULT GRAPH | GRAPH[S] { * | name[, ...] }}
TO role[, ...]
For example, granting the ability to set any label on nodes of the graph neo4j to the role regularUsers would be achieved using:
GRANT SET LABEL * ON GRAPH neo4j TO regularUsers
0 rows, System updates: 1
|
Unlike many of the other read and write privileges, it is not possible to restrict the |
The SET LABEL privilege can also be denied.
DENY SET LABEL { * | label[, ...] }
ON {DEFAULT GRAPH | GRAPH[S] { * | name[, ...] }}
TO role[, ...]
For example, denying the ability to set the label foo on nodes of all graphs to the role regularUsers would be achieved using:
DENY SET LABEL foo ON GRAPH * TO regularUsers
0 rows, System updates: 1
|
If no instances of this label exist in the database, then the CREATE NEW LABEL privilege is also required. |
The REMOVE LABEL privilege
The REMOVE LABEL privilege allows you to remove labels from a node using the REMOVE clause.
GRANT REMOVE LABEL { * | label[, ...] }
ON {DEFAULT GRAPH | GRAPH[S] { * | name[, ...] }}
TO role[, ...]
For example, granting the ability to remove any label from nodes of the graph neo4j to the role regularUsers would be achieved using:
GRANT REMOVE LABEL * ON GRAPH neo4j TO regularUsers
0 rows, System updates: 1
|
Unlike many of the other read and write privileges, it is not possible to restrict the |
The REMOVE LABEL privilege can also be denied.
DENY REMOVE LABEL { * | label[, ...] }
ON {DEFAULT GRAPH | GRAPH[S] { * | name[, ...] }}
TO role[, ...]
For example, denying the ability to remove the label foo from nodes of all graphs to the role regularUsers would be achieved using:
DENY REMOVE LABEL foo ON GRAPH * TO regularUsers
0 rows, System updates: 1
The SET PROPERTY privilege
The SET PROPERTY privilege allows a user to set a property on a node or relationship element in a graph using the SET clause.
GRANT SET PROPERTY "{" { * | property[, ...] } "}"
ON {DEFAULT GRAPH | GRAPH[S] { * | name[, ...] }}
[
ELEMENT[S] { * | label-or-rel-type[, ...] }
| NODE[S] { * | label[, ...] }
| RELATIONSHIP[S] { * | rel-type[, ...] }
]
TO role[, ...]
For example, granting the ability to set any property on all elements of the graph neo4j to the role regularUsers would be achieved using:
GRANT SET PROPERTY {*} ON DEFAULT GRAPH ELEMENTS * TO regularUsers
0 rows, System updates: 2
The SET PROPERTY privilege can also be denied.
DENY SET PROPERTY "{" { * | property[, ...] } "}"
ON {DEFAULT GRAPH | GRAPH[S] { * | name[, ...] }}
[
ELEMENT[S] { * | label-or-rel-type[, ...] }
| NODE[S] { * | label[, ...] }
| RELATIONSHIP[S] { * | rel-type[, ...] }
]
TO role[, ...]
For example, denying the ability to set the property foo on nodes with the label bar on all graphs to the role regularUsers would be achieved using:
DENY SET PROPERTY { foo } ON GRAPH * NODES bar TO regularUsers
0 rows, System updates: 1
|
If the users attempts to set a property with a property name that does not already exist in the database the user must also possess the CREATE NEW PROPERTY NAME privilege. |
The MERGE privilege
The MERGE privilege is a compound privilege that combines TRAVERSE and READ (i.e. MATCH) with CREATE and SET PROPERTY. This is intended to
permit use of the MERGE command but is applicable to all reads and writes that require these privileges.
GRANT MERGE "{" { * | property[, ...] } "}"
ON {DEFAULT GRAPH | GRAPH[S] { * | name[, ...] }}
[
ELEMENT[S] { * | label-or-rel-type[, ...] }
| NODE[S] { * | label[, ...] }
| RELATIONSHIP[S] { * | rel-type[, ...] }
]
TO role[, ...]
For example, granting MERGE on all elements of the graph neo4j to the role regularUsers would be achieved using:
GRANT MERGE {*} ON GRAPH neo4j ELEMENTS * TO regularUsers
0 rows, System updates: 2
It is not possible to deny the MERGE privilege. If it is desirable to prevent a users from creating elements and setting properties, use
DENY CREATE or DENY SET PROPERTY.
|
If the users attempts to create nodes with a label that does not already exist in the database the user must also possess the CREATE NEW LABEL privilege. The same applies to new relationships and properties - the CREATE NEW RELATIONSHIP TYPE or CREATE NEW PROPERTY NAME privileges are required. |
The WRITE privilege
The WRITE privilege allows the user to execute any write command on a graph.
GRANT WRITE
ON {DEFAULT GRAPH | GRAPH[S] { * | name[, ...] }}
TO role[, ...]
For example, granting the ability to write on the graph neo4j to the role regularUsers would be achieved using:
GRANT WRITE ON GRAPH neo4j TO regularUsers
0 rows, System updates: 2
|
Unlike the more specific write commands, it is not possible to restrict |
The WRITE privilege can also be denied.
DENY WRITE
ON {DEFAULT GRAPH | GRAPH[S] { * | name[, ...] }}
TO role[, ...]
For example, denying the ability to write on the graph neo4j to the role regularUsers would be achieved using:
DENY WRITE ON GRAPH neo4j TO regularUsers
0 rows, System updates: 2
|
Users with |
ALL GRAPH PRIVILEGES
The ALL GRAPH PRIVILEGES privilege allows the user to execute any command on a graph.
GRANT ALL [ [ GRAPH ] PRIVILEGES ]
ON {DEFAULT GRAPH | GRAPH[S] { * | name[, ...] }}
TO role[, ...]
For example, granting all graph privileges on the graph neo4j to the role regularUsers would be achieved using:
GRANT ALL GRAPH PRIVILEGES ON GRAPH neo4j TO regularUsers
0 rows, System updates: 1
|
Unlike the more specific read and write commands, it is not possible to restrict |
The ALL GRAPH PRIVILEGES privilege can also be denied.
DENY ALL [ [ GRAPH ] PRIVILEGES ]
ON {DEFAULT GRAPH | GRAPH[S] { * | name[, ...] }}
TO role[, ...]
For example, denying all graph privileges on the graph neo4j to the role regularUsers would be achieved using:
DENY ALL GRAPH PRIVILEGES ON GRAPH neo4j TO regularUsers
0 rows, System updates: 1