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}]) Выдача прав пользователю или другой роли.
Параметры: - username (
string) – the name of a user to grant privileges to - permissions (
string) – one or more permissions to grant to the user (for example,readorread,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
Если указана
'function','object-name', то должен существовать кортеж _func с этим именем объекта.Variation: instead of
object-type, object-namesayuniversewhich means „all object-types and all objects“. In this case, object name is omitted.Variation: instead of
permissions, object-type, object-namesayrole-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')(see section box.schema.user.enable).Возможны следующие опции:
grantor= grantor_name_or_id – строка или число, для пользователя, который выдает права,if_not_exists=true|false(default =false) - boolean;trueозначает, что ошибки не должно быть, если пользователь уже имеет права.
Пример:
box.schema.user.grant('testuser', 'read', 'space', 'writers') box.schema.user.grant('testuser', 'read,write', 'space', 'books')
See also: Managing users.
- username (