Skip to content

Commit 6406bbd

Browse files
authored
Adds **Revoking grants from a user** paragraph (#5161)
* Adds **Revoking grants from a user** paragraph * New paragraph explains how to revoke privileges manipulating config file * Fixes #5152
1 parent ad07f4f commit 6406bbd

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# empty permissions array:
2+
privileges:
3+
- permissions: [] # !! read permission revoked !!
4+
spaces: [books]
5+
6+
# empty privileges array:
7+
privileges: [] # !! no privileges at all !!
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# grant privileges:
2+
privileges:
3+
- permissions: [read, write]
4+
spaces: [books]
5+
6+
# revoke a privilege:
7+
privileges:
8+
- permissions: [read] # !! write permission revoked !!
9+
spaces: [books]

doc/platform/connections_and_auth/credentials.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,38 @@ In this example, ``sampleuser`` gets privileges to select and modify data in the
8080

8181
You can find the full example here: `credentials <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/config/instances.enabled/credentials>`_.
8282

83+
.. _configuration_credentials_managing_users_roles_revoking_privileges:
8384

85+
Revoking privileges from a user
86+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
87+
88+
To revoke a previously granted privilege, remove it from the configuration.
89+
90+
For example, here is how to grant privileges to a space and how to revoke one of the privileges:
91+
92+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/credentials/revoke_one.yaml
93+
:language: yaml
94+
:start-at: # grant privileges
95+
:dedent:
96+
97+
If you want to revoke the remaining privilege to from a space, you can remove it, too, thus making ``permissions`` an empty array:
98+
99+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/credentials/revoke_all.yaml
100+
:language: yaml
101+
:start-at: # empty permissions array:
102+
:end-at: [books]
103+
:dedent:
104+
105+
You can revoke all privileges by making the ``privileges`` an empty array:
106+
107+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/credentials/revoke_all.yaml
108+
:language: yaml
109+
:start-at: # empty privileges array:
110+
:dedent:
111+
112+
.. warning::
113+
Do not remove a user or a role from configuration in order to revoke that user's or role's privileges. If a user or a role is entirely
114+
removed from the configuration, it is not tracked by configuration machinery anymore. The user/role is not removed and its privileges are not revoked.
84115

85116
.. _configuration_credentials_loading_secrets:
86117

0 commit comments

Comments
 (0)