Skip to content

Commit 9f799c7

Browse files
committed
Credentials: update per TW review - update reference
1 parent 0f48f28 commit 9f799c7

File tree

13 files changed

+100
-116
lines changed

13 files changed

+100
-116
lines changed

doc/reference/reference_lua/box_schema/role_create.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ box.schema.role.create()
2222

2323
**Example:**
2424

25-
.. code-block:: lua
25+
.. literalinclude:: /code_snippets/test/access_control/grant_roles_test.lua
26+
:language: lua
27+
:start-after: Create roles
28+
:end-before: End: Create roles
29+
:dedent:
2630

27-
box.schema.role.create('Accountant')
28-
box.schema.role.create('Accountant', {if_not_exists = false})
31+
See also: :ref:`access_control_roles`.

doc/reference/reference_lua/box_schema/role_drop.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ box.schema.role.drop()
1818

1919
**Example:**
2020

21-
.. code-block:: lua
21+
.. literalinclude:: /code_snippets/test/access_control/grant_roles_test.lua
22+
:language: lua
23+
:start-after: Dropping a role
24+
:end-before: End: Dropping a role
25+
:dedent:
2226

23-
box.schema.role.drop('Accountant')
27+
See also: :ref:`access_control_roles`.

doc/reference/reference_lua/box_schema/role_exists.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,4 @@ box.schema.role.exists()
1313
:param string role-name: the name of the role
1414
:rtype: bool
1515

16-
**Example:**
17-
18-
.. code-block:: lua
19-
20-
box.schema.role.exists('Accountant')
16+
See also: :ref:`access_control_roles_info`.

doc/reference/reference_lua/box_schema/role_grant.rst

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,28 @@ box.schema.role.grant()
1212

1313
Grant :ref:`privileges <authentication-owners_privileges>` to a role.
1414

15-
:param string role-name: the name of the role.
16-
:param string privilege: 'read' or 'write' or 'execute' or 'create' or
17-
'alter' or 'drop' or a combination.
18-
:param string object-type: 'space' or 'function' or 'sequence' or 'role'.
19-
:param string object-name: the name of a function or space or sequence or role.
15+
:param string role-name: the name of the role
16+
:param string privilege: one or more :ref:`privileges <access_control_list_privileges>` to grant to the role (for example, ``read`` or ``read,write``)
17+
:param string object-type: a database :ref:`object type <access_control_list_objects>` to grant privileges to (for example, ``space``, ``role``, or ``function``)
18+
:param string object-name: the name of a function or space or sequence or role
2019
:param table option: ``if_not_exists`` = ``true|false`` (default = ``false``) - boolean;
2120
``true`` means there should be no error if the role already
22-
has the privilege.
21+
has the privilege
2322

2423
The role must exist, and the object must exist.
2524

26-
**Variation:** instead of ``object-type, object-name`` say 'universe'
25+
**Variation:** instead of ``object-type, object-name`` say ``universe``
2726
which means 'all object-types and all objects'. In this case, object name is omitted.
2827

2928
**Variation:** instead of ``privilege, object-type, object-name`` say
3029
``role-name`` -- to grant a role to a role.
3130

3231
**Example:**
3332

34-
.. code-block:: lua
33+
.. literalinclude:: /code_snippets/test/access_control/grant_roles_test.lua
34+
:language: lua
35+
:start-after: Grant read/write privileges to a role
36+
:end-before: Grant write privileges to a role
37+
:dedent:
3538

36-
box.schema.role.grant('Accountant', 'read', 'space', 'tester')
37-
box.schema.role.grant('Accountant', 'execute', 'function', 'f')
38-
box.schema.role.grant('Accountant', 'read,write', 'universe')
39-
box.schema.role.grant('public', 'Accountant')
40-
box.schema.role.grant('role1', 'role2', nil, nil, {if_not_exists=false})
39+
See also: :ref:`access_control_roles`.

doc/reference/reference_lua/box_schema/role_info.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,4 @@ box.schema.role.info()
1212

1313
:param string role-name: the name of the role.
1414

15-
**Example:**
16-
17-
.. code-block:: lua
18-
19-
box.schema.role.info('Accountant')
15+
See also: :ref:`access_control_roles_info`.

doc/reference/reference_lua/box_schema/role_revoke.rst

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,18 @@ box.schema.role.revoke()
1010

1111
Revoke :ref:`privileges <authentication-owners_privileges>` from a role.
1212

13-
:param string role-name: the name of the role.
14-
:param string privilege: 'read' or 'write' or 'execute' or 'create' or
15-
'alter' or 'drop' or a combination.
16-
:param string object-type: 'space' or 'function' or 'sequence' or 'role'.
17-
:param string object-name: the name of a function or space or sequence or role.
13+
:param string role-name: the name of the role
14+
:param string privilege: one or more :ref:`privileges <access_control_list_privileges>` to revoke from the role (for example, ``read`` or ``read,write``)
15+
:param string object-type: a database :ref:`object type <access_control_list_objects>` to revoke privileges from (for example, ``space``, ``role``, or ``function``)
16+
:param string object-name: the name of a database object to revoke privileges from
1817

1918
The role must exist, and the object must exist,
2019
but it is not an error if the role does not have the privilege.
2120

22-
**Variation:** instead of ``object-type, object-name`` say 'universe'
21+
**Variation:** instead of ``object-type, object-name`` say ``universe``
2322
which means 'all object-types and all objects'.
2423

2524
**Variation:** instead of ``privilege, object-type, object-name`` say
2625
``role-name``.
2726

28-
**Example:**
29-
30-
.. code-block:: lua
31-
32-
box.schema.role.revoke('Accountant', 'read', 'space', 'tester')
33-
box.schema.role.revoke('Accountant', 'execute', 'function', 'f')
34-
box.schema.role.revoke('Accountant', 'read,write', 'universe')
35-
box.schema.role.revoke('public', 'Accountant')
27+
See also: :ref:`access_control_roles`.

doc/reference/reference_lua/box_schema/user_create.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ box.schema.user.create()
2121
* ``password`` (default = '') - string; the ``password`` = *password*
2222
specification is good because in a :ref:`URI <index-uri>`
2323
(Uniform Resource Identifier) it is usually illegal to include a
24-
user-name without a password.
24+
username without a password.
2525

2626
.. NOTE::
2727

@@ -34,8 +34,10 @@ box.schema.user.create()
3434

3535
**Examples:**
3636

37-
.. code-block:: lua
37+
.. literalinclude:: /code_snippets/test/access_control/grant_user_privileges_test.lua
38+
:language: lua
39+
:start-after: Create a user with a password
40+
:end-before: End: Create a user with a password
41+
:dedent:
3842

39-
box.schema.user.create('testuser')
40-
box.schema.user.create('testuser', {password = 'foobar'})
41-
box.schema.user.create('testuser', {if_not_exists = false})
43+
See also: :ref:`access_control_users`.

doc/reference/reference_lua/box_schema/user_drop.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,23 @@ box.schema.user.drop()
66

77
.. module:: box.schema
88

9-
.. function:: box.schema.user.drop(user-name [, {options}])
9+
.. function:: box.schema.user.drop(username [, {options}])
1010

1111
Drop a user.
1212
For explanation of how Tarantool maintains user data, see
1313
section :ref:`Users <authentication-users>` and reference on
1414
:ref:`_user <box_space-user>` space.
1515

16-
:param string user-name: the name of the user
16+
:param string username: the name of the user
1717
:param table options: ``if_exists`` = ``true|false`` (default = ``false``) - boolean;
1818
``true`` means there should be no error if the user does not exist.
1919

2020
**Examples:**
2121

22-
.. code-block:: lua
22+
.. literalinclude:: /code_snippets/test/access_control/grant_user_privileges_test.lua
23+
:language: lua
24+
:start-after: Drop a user
25+
:end-before: End: Drop a user
26+
:dedent:
2327

24-
box.schema.user.drop('Lena')
25-
box.schema.user.drop('Lena',{if_exists=false})
28+
See also: :ref:`access_control_users`.

doc/reference/reference_lua/box_schema/user_exists.rst

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,14 @@ box.schema.user.exists()
66

77
.. module:: box.schema
88

9-
.. function:: box.schema.user.exists(user-name)
9+
.. function:: box.schema.user.exists(username)
1010

1111
Return ``true`` if a user exists; return ``false`` if a user does not exist.
1212
For explanation of how Tarantool maintains user data, see
1313
section :ref:`Users <authentication-users>` and reference on
1414
:ref:`_user <box_space-user>` space.
1515

16-
:param string user-name: the name of the user
16+
:param string username: the name of the user
1717
:rtype: bool
1818

19-
**Example:**
20-
21-
.. code-block:: lua
22-
23-
box.schema.user.exists('Lena')
19+
See also: :ref:`access_control_user_info`.

doc/reference/reference_lua/box_schema/user_grant.rst

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@ box.schema.user.grant()
66

77
.. module:: box.schema
88

9-
.. function:: box.schema.user.grant(user-name, privileges, object-type, object-name[, {options} ])
10-
box.schema.user.grant(user-name, privileges, 'universe'[, nil, {options} ])
11-
box.schema.user.grant(user-name, role-name[, nil, nil, {options} ])
9+
.. function:: box.schema.user.grant(username, privileges, object-type, object-name[, {options} ])
10+
box.schema.user.grant(username, privileges, 'universe'[, nil, {options} ])
11+
box.schema.user.grant(username, role-name[, nil, nil, {options} ])
1212

1313
Grant :ref:`privileges <authentication-owners_privileges>` to a user or
1414
to another role.
1515

16-
:param string user-name: the name of a user to grant privileges to
17-
:param string privileges: one or more privileges to grant to the user (for example, `read` or `read,write`)
18-
:param string object-type: a database object type to grant privileges to (for example, `space`, `role`, or `function`)
16+
:param string username: the name of a user to grant privileges to
17+
:param string privileges: one or more :ref:`privileges <access_control_list_privileges>` to grant to the user (for example, ``read`` or ``read,write``)
18+
:param string object-type: a database :ref:`object type <access_control_list_objects>` to grant privileges to (for example, ``space``, ``role``, or ``function``)
1919
:param string object-name: the name of a database object to grant privileges to
2020
:param string role-name: the name of a role to grant to the user
2121
:param table options: ``grantor``, ``if_not_exists``
2222

2323
If :samp:`'function','{object-name}'` is specified, then a _func tuple with
2424
that object-name must exist.
2525

26-
**Variation:** instead of ``object-type, object-name`` say 'universe' which
26+
**Variation:** instead of ``object-type, object-name`` say ``universe`` which
2727
means 'all object-types and all objects'. In this case, object name is omitted.
2828

2929
**Variation:** instead of ``privilege, object-type, object-name`` say
3030
``role-name`` (see section :ref:`Roles <authentication-roles>`).
3131

3232
**Variation:** instead of
33-
:samp:`box.schema.user.grant('{user-name}','usage,session','universe',nil,` :code:`{if_not_exists=true})`
34-
say :samp:`box.schema.user.enable('{user-name}')`.
33+
:samp:`box.schema.user.grant('{username}','usage,session','universe',nil,` :code:`{if_not_exists=true})`
34+
say :samp:`box.schema.user.enable('{username}')`.
3535

3636
The possible options are:
3737

@@ -41,11 +41,10 @@ box.schema.user.grant()
4141

4242
**Example:**
4343

44-
.. code-block:: lua
44+
.. literalinclude:: /code_snippets/test/access_control/grant_user_privileges_test.lua
45+
:language: lua
46+
:start-after: Grant privileges to the specified user
47+
:end-before: End: Grant privileges to the specified user
48+
:dedent:
4549

46-
box.schema.user.grant('Lena', 'read', 'space', 'tester')
47-
box.schema.user.grant('Lena', 'execute', 'function', 'f')
48-
box.schema.user.grant('Lena', 'read,write', 'universe')
49-
box.schema.user.grant('Lena', 'Accountant')
50-
box.schema.user.grant('Lena', 'read,write,execute', 'universe')
51-
box.schema.user.grant('X', 'read', 'universe', nil, {if_not_exists=true})
50+
See also: :ref:`access_control_users`.

doc/reference/reference_lua/box_schema/user_info.rst

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,14 @@ box.schema.user.info()
66

77
.. module:: box.schema
88

9-
.. function:: box.schema.user.info([user-name])
9+
.. function:: box.schema.user.info([username])
1010

1111
Return a description of a user's :ref:`privileges <authentication-owners_privileges>`.
1212

13-
:param string user-name: the name of the user.
14-
This is optional; if it is not
15-
supplied, then the information
16-
will be for the user who is
17-
currently logged in.
13+
:param string username: the name of the user.
14+
This is optional; if it is not
15+
supplied, then the information
16+
will be for the user who is
17+
currently logged in.
1818

19-
**Example:**
20-
21-
.. code-block:: tarantoolsession
22-
23-
tarantool> box.schema.user.info('admin')
24-
---
25-
- - - read,write,execute,session,usage,create,drop,alter,reference,trigger,insert,update,delete
26-
- universe
27-
-
28-
...
19+
See also: :ref:`access_control_user_info`.

doc/reference/reference_lua/box_schema/user_passwd.rst

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,25 @@ box.schema.user.passwd()
66

77
.. module:: box.schema
88

9-
.. function:: box.schema.user.passwd([name,] new_password)
9+
.. function:: box.schema.user.passwd([username,] password)
1010

1111
Sets a password for a currently logged in or a specified user:
1212

13-
* A currently logged in user can change their password using
14-
``box.schema.user.passwd(new_password)``.
13+
* A currently logged-in user can change their password using
14+
``box.schema.user.passwd(password)``.
1515

1616
* An administrator can change the password of another user with
17-
``box.schema.user.passwd(name, new_password)``.
17+
``box.schema.user.passwd(username, password)``.
1818

19-
:param string user-name: name
20-
:param string password: new_password
19+
:param string username: a username
20+
:param string password: a new password
2121

2222
**Example:**
2323

24-
.. code-block:: lua
24+
.. literalinclude:: /code_snippets/test/access_control/grant_user_privileges_test.lua
25+
:language: lua
26+
:start-after: Set a password for the specified user
27+
:end-before: End: Set a password for the specified user
28+
:dedent:
2529

26-
box.schema.user.passwd('foobar')
27-
box.schema.user.passwd('testuser', 'foobar')
30+
See also: :ref:`access_control_users`.

doc/reference/reference_lua/box_schema/user_revoke.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@ box.schema.user.revoke()
66

77
.. module:: box.schema
88

9-
.. function:: box.schema.user.revoke(user-name, privileges, object-type, object-name[, {options} ])
10-
box.schema.user.revoke(user-name, privileges, 'universe'[, nil, {options} ])
11-
box.schema.user.revoke(user-name, role-name[, nil, nil, {options} ])
9+
.. function:: box.schema.user.revoke(username, privileges, object-type, object-name[, {options} ])
10+
box.schema.user.revoke(username, privileges, 'universe'[, nil, {options} ])
11+
box.schema.user.revoke(username, role-name[, nil, nil, {options} ])
1212

1313
Revoke :ref:`privileges <authentication-owners_privileges>` from a user
1414
or from another role.
1515

16-
:param string user-name: the name of the user.
17-
:param string privilege: 'read' or 'write' or 'execute' or 'create' or
18-
'alter' or 'drop' or a combination.
19-
:param string object-type: 'space' or 'function' or 'sequence'.
20-
:param string object-name: the name of a function or space or sequence.
21-
:param table options: ``if_exists``.
16+
:param string username: the name of the user
17+
:param string privilege: one or more :ref:`privileges <access_control_list_privileges>` to revoke from the user (for example, ``read`` or ``read,write``)
18+
:param string object-type: a database :ref:`object type <access_control_list_objects>` to revoke privileges from (for example, ``space``, ``role``, or ``function``)
19+
:param string object-name: the name of a database object to revoke privileges from
20+
:param table options: ``if_exists``
2221

2322
The user must exist, and the object must exist,
2423
but if the option setting is ``{if_exists=true}`` then
@@ -31,14 +30,15 @@ box.schema.user.revoke()
3130
``role-name`` (see section :ref:`Roles <authentication-roles>`).
3231

3332
**Variation:** instead of
34-
:samp:`box.schema.user.revoke('{user-name}','usage,session','universe',nil,` :code:`{if_exists=true})`
35-
say :samp:`box.schema.user.disable('{user-name}')`.
33+
:samp:`box.schema.user.revoke('{username}','usage,session','universe',nil,` :code:`{if_exists=true})`
34+
say :samp:`box.schema.user.disable('{username}')`.
3635

3736
**Example:**
3837

39-
.. code-block:: lua
38+
.. literalinclude:: /code_snippets/test/access_control/grant_user_privileges_test.lua
39+
:language: lua
40+
:start-after: Revoke space reading
41+
:end-before: End: Revoke space reading
42+
:dedent:
4043

41-
box.schema.user.revoke('Lena', 'read', 'space', 'tester')
42-
box.schema.user.revoke('Lena', 'execute', 'function', 'f')
43-
box.schema.user.revoke('Lena', 'read,write', 'universe')
44-
box.schema.user.revoke('Lena', 'Accountant')
44+
See also: :ref:`access_control_users`.

0 commit comments

Comments
 (0)