Skip to content

Commit a009ed8

Browse files
authored
Adds description of granting access via lua_call (#5148)
* With the ```lua_call``` priviledge any user can be given access to non-persistent functions * The function may be defined after the priviledge is given * Fixes #3628
1 parent 94b40d8 commit a009ed8

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

doc/admin/access_control.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,31 @@ To give the ability to execute a function named 'sum', grant the following privi
797797
798798
box.schema.user.grant('testuser','execute','function','sum')
799799
800+
.. _access_control_grant_lua_functions_execute:
800801

802+
Executing lua functions
803+
***********************
804+
805+
Granting the 'execute' privilege on ``lua_call`` permits the user to call any global (accessible via the ``_G`` Lua table)
806+
user-defined Lua function with the ``IPROTO_CALL`` request. To grant permission to any non-persistent function, you need to
807+
specify its name when granting the ``lua_call`` privilege.
808+
809+
.. NOTE::
810+
811+
The function doesn't need to be defined at the time privileges are granted, meaning that the access to the function will be provided for the user once this function is defined.
812+
813+
.. code-block:: lua
814+
815+
function my_func_1() end
816+
function my_func_2() end
817+
box.cfg({listen = 3301})
818+
box.schema.user.create('alice', {password = 'secret'})
819+
conn = require('net.box').connect(box.cfg.listen, {user = 'alice', password = 'secret'})
820+
box.schema.user.grant('alice', 'execute', 'lua_call', 'my_func_1')
821+
conn:call('my_func_1') -- ok
822+
conn:call('my_func_2') -- access denied
823+
box.schema.user.grant('alice', 'execute', 'lua_call', 'box.session.su')
824+
conn:call('box.session.su', {'admin'}) -- ok
801825
802826
803827

0 commit comments

Comments
 (0)