Skip to content

Commit c73a76f

Browse files
imilinovicmatea16
andauthored
First user privileges docs (#1486)
* first user docs * changes * changes * changes * Update pages/database-management/authentication-and-authorization/role-based-access-control.mdx --------- Co-authored-by: Matea Pesic <[email protected]>
1 parent 58d6362 commit c73a76f

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed

pages/database-management/authentication-and-authorization/role-based-access-control.mdx

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,13 @@ of the following commands:
184184
For a comprehensive reference of which privileges are required for specific queries and operations, see the [Query privileges reference](/database-management/authentication-and-authorization/query-privileges) documentation.
185185
</Callout>
186186

187+
### First user privileges
188+
189+
When you create the first user in Memgraph, that user automatically becomes a
190+
superuser (administrator account with full system access) with all privileges.
191+
See the [templates for granting privileges](#templates-for-granting-privileges)
192+
section for details on what privileges are granted.
193+
187194
## Authentication and authorization requirements
188195

189196
<Callout type="info">
@@ -258,14 +265,19 @@ In this setup:
258265
- Application data is stored in tenant-specific databases, not in the default
259266
"memgraph" database
260267

261-
After the first user is created, Memgraph will execute a query if and only if
262-
either a user or its role is granted that privilege and neither the user nor its
263-
role are denied that privilege. Otherwise, Memgraph will not execute that
264-
specific query. Note that `DENY` is a stronger operation than `GRANT`. This is
265-
also notable from the fact that if neither the user nor its role are explicitly
266-
granted or denied a certain privilege, that user will not be able to perform
267-
that specific query. This effect is also known as a silent deny. The information
268-
above is neatly condensed in the following table:
268+
After the first user is created, Memgraph switches from "allow everything" mode
269+
(when no users exist) to "access controlled" mode. From that point forward, all
270+
connections must authenticate with valid credentials, and unauthenticated
271+
connections will be rejected.
272+
273+
Memgraph will execute a query if and only if either a user or its role is
274+
granted that privilege and neither the user nor its role are denied that
275+
privilege. Otherwise, Memgraph will not execute that specific query. Note that
276+
`DENY` is a stronger operation than `GRANT`. This is also notable from the fact
277+
that if neither the user nor its role are explicitly granted or denied a certain
278+
privilege, that user will not be able to perform that specific query. This effect
279+
is also known as a silent deny. The information above is neatly condensed in the
280+
following table:
269281

270282
User Status | Role Status | Effective Status
271283
------------|-------------|------------------
@@ -724,6 +736,14 @@ permissions) for the user or role in the specified database context.
724736

725737
### Templates for granting privileges
726738

739+
<Callout type="info">
740+
741+
**Note**: The first user created automatically receives all privileges (as
742+
described in the [First user privileges](#first-user-privileges) section). The
743+
following templates are for granting privileges to additional users or roles.
744+
745+
</Callout>
746+
727747
To grant all privileges to a superuser (admin):
728748

729749
```cypher

pages/database-management/authentication-and-authorization/users.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ CREATE USER [IF NOT EXISTS] user_name [IDENTIFIED BY 'password'];
3333
```
3434
If the user already exists, you can use `IF NOT EXISTS` to only create new users.
3535

36+
<Callout type="info">
37+
38+
**First user privileges**: The first user created in Memgraph automatically
39+
becomes a superuser with all privileges. See the [Role-based access
40+
control](/database-management/authentication-and-authorization/role-based-access-control#first-user-privileges)
41+
documentation for details.
42+
43+
</Callout>
44+
3645
If the username is an email address, you need to enclose it in backticks (``` ` ```):
3746

3847
```cypher

0 commit comments

Comments
 (0)