box.schema.user.grant()
-
box.schema.user.
grant
(username, permissions, object-type, object-name[, {options}])¶ -
box.schema.user.
grant
(username, permissions, 'universe'[, nil, {options}]) -
box.schema.user.
grant
(username, role-name[, nil, nil, {options}]) Grant privileges to a user or to another role.
Parameters: - username (
string
) – the name of a user to grant privileges to - permissions (
string
) – one or more permissions to grant to the user (for example,read
orread,write
) - object-type (
string
) – a database object type to grant permissions to (for example,space
,role
, orfunction
) - object-name (
string
) – the name of a database object to grant permissions to - role-name (
string
) – the name of a role to grant to the user - options (
table
) –grantor
,if_not_exists
If
'function','object-name'
is specified, then a _func tuple with that object-name must exist.Variation: instead of
object-type, object-name
sayuniverse
which means ‘all object-types and all objects’. In this case, object name is omitted.Variation: instead of
permissions, object-type, object-name
sayrole-name
(see section Roles).Variation: instead of
box.schema.user.grant('username','usage,session','universe',nil,
{if_not_exists=true})
saybox.schema.user.enable('username')
.The possible options are:
grantor
= grantor_name_or_id – string or number, for custom grantor,if_not_exists
=true|false
(default =false
) - boolean;true
means there should be no error if the user already has the privilege.
Example:
box.schema.user.grant('testuser', 'read', 'space', 'writers') box.schema.user.grant('testuser', 'read,write', 'space', 'books')
See also: Managing users.
- username (