Skip to content

Commit 28f1245

Browse files
authored
Adds box.schema.user.enable and box.schema.user.disable methods (#5123)
* Added ``box.schema.user.enable`` and ``box.schema.user.disable`` methods description to Submodule ``box.schema`` * 2 new files ("user_enable.rst" and user_disable.rst") added to the ``box.schema`` submodule. * Files describe methods that grant and revoke permissions. * References added to existing files ("box_schema.rst", "user_grant.rst", "user_revoke.rst") Fixes #5122
1 parent f7deeb8 commit 28f1245

File tree

5 files changed

+72
-2
lines changed

5 files changed

+72
-2
lines changed

doc/reference/reference_lua/box_schema.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ Below is a list of all ``box.schema`` functions.
5353
* - :doc:`./box_schema/user_revoke`
5454
- Revoke privileges from a user or a role
5555

56+
* - :doc:`./box_schema/user_enable`
57+
- Grant ``usage`` and ``session`` permissions
58+
59+
* - :doc:`./box_schema/user_disable`
60+
- Revoke ``usage`` and ``session`` permissions
61+
5662
* - :doc:`./box_schema/user_password`
5763
- Get a hash of a user's password
5864

@@ -105,6 +111,8 @@ Below is a list of all ``box.schema`` functions.
105111
box_schema/user_exists
106112
box_schema/user_grant
107113
box_schema/user_revoke
114+
box_schema/user_enable
115+
box_schema/user_disable
108116
box_schema/user_password
109117
box_schema/user_passwd
110118
box_schema/user_info
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.. _box_schema-user_disable:
2+
3+
===============================================================================
4+
box.schema.user.disable()
5+
===============================================================================
6+
7+
.. module:: box.schema
8+
9+
.. function:: box.schema.user.disable(username)
10+
11+
Revokes ``usage`` and ``session`` permissions from the subject user. Equivalent to the following call:
12+
13+
.. code-block:: lua
14+
15+
box.schema.user.revoke(username, 'usage,session', 'universe', nil, {if_not_exists = true})
16+
17+
.. NOTE::
18+
19+
* ``session`` - allows the binary protocol layer (iproto) to authenticate the user
20+
21+
* ``usage`` - lets user use their privileges on database objects (such as read, write and alter space)
22+
23+
For more information about revoking permissions see section :ref:`box.schema.user.revoke <box_schema-user_revoke>`.
24+
25+
:param string username: the name of the subject user
26+
27+
:return: (if success) nothing
28+
29+
Possible errors:
30+
31+
* ``NO_SUCH_USER`` - in case the subject user is not found.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.. _box_schema-user_enable:
2+
3+
===============================================================================
4+
box.schema.user.enable()
5+
===============================================================================
6+
7+
.. module:: box.schema
8+
9+
.. function:: box.schema.user.enable(username)
10+
11+
Grants ``usage`` and ``session`` permissions to the subject user. Equivalent to the following call:
12+
13+
.. code-block:: lua
14+
15+
box.schema.user.grant(username, 'usage,session', 'universe', nil, {if_not_exists = true})
16+
17+
.. NOTE::
18+
19+
* ``session`` - allows the binary protocol layer (iproto) to authenticate the user
20+
21+
* ``usage`` - lets user use their privileges on database objects (such as read, write and alter space)
22+
23+
For more information about granting permissions see section :ref:`box.schema.user.grant <box_schema-user_grant>`.
24+
25+
:param string username: the name of the subject user
26+
27+
:return: (if success) nothing
28+
29+
Possible errors:
30+
31+
* ``NO_SUCH_USER`` - in case the subject user is not found.

doc/reference/reference_lua/box_schema/user_grant.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ box.schema.user.grant()
3131

3232
**Variation:** instead of
3333
:samp:`box.schema.user.grant('{username}','usage,session','universe',nil,` :code:`{if_not_exists=true})`
34-
say :samp:`box.schema.user.enable('{username}')`.
34+
say :samp:`box.schema.user.enable('{username}')` (see section :ref:`box.schema.user.enable <box_schema-user_enable>`).
3535

3636
The possible options are:
3737

doc/reference/reference_lua/box_schema/user_revoke.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ box.schema.user.revoke()
3131

3232
**Variation:** instead of
3333
:samp:`box.schema.user.revoke('{username}','usage,session','universe',nil,` :code:`{if_exists=true})`
34-
say :samp:`box.schema.user.disable('{username}')`.
34+
say :samp:`box.schema.user.disable('{username}')` (see section :ref:`box.schema.user.disable <box_schema-user_disable>`).
3535

3636
**Example:**
3737

0 commit comments

Comments
 (0)