box.schema.user.grant()
-
box.schema.user.grant(user-name, privileges, object-type, object-name[, {options}])¶ -
box.schema.user.grant(user-name, privileges, 'universe'[, nil, {options}]) -
box.schema.user.grant(user-name, role-name[, nil, nil, {options}]) Выдача прав пользователю или другой роли.
Параметры: - user-name (
string) – the name of a user to grant privileges to - privileges (
string) – one or more privileges to grant to the user (for example,readorread,write) - object-type (
string) – a database object type to grant privileges to (for example,space,role, orfunction) - object-name (
string) – the name of a database object to grant privileges to - role-name (
string) – the name of a role to grant to the user - options (
table) –grantor,if_not_exists
Если указана
'function','object-name', то должен существовать кортеж _func с этим именем объекта.Вариант: вместо
object-type, object-nameвведите „universe“, что означает „все типы объектов и все объекты“. В этом случае имя объекта будет опущено.Вариант: вместо
privilege, object-type, object-nameвведитеrole-name(см. Roles)Вариант: вместо
box.schema.user.grant('user-name','usage,session','universe',nil,{if_not_exists=true})введитеbox.schema.user.enable('user-name').Возможны следующие опции:
grantor= grantor_name_or_id – строка или число, для пользователя, который выдает права,if_not_exists=true|false(default =false) - boolean;trueозначает, что ошибки не должно быть, если пользователь уже имеет права.
Пример:
box.schema.user.grant('Lena', 'read', 'space', 'tester') box.schema.user.grant('Lena', 'execute', 'function', 'f') box.schema.user.grant('Lena', 'read,write', 'universe') box.schema.user.grant('Lena', 'Accountant') box.schema.user.grant('Lena', 'read,write,execute', 'universe') box.schema.user.grant('X', 'read', 'universe', nil, {if_not_exists=true})
- user-name (