Skip to content

Adds description of granting access via lua_call #5148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions doc/admin/access_control.rst
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,31 @@ To give the ability to execute a function named 'sum', grant the following privi

box.schema.user.grant('testuser','execute','function','sum')

.. _access_control_grant_lua_functions_execute:

Executing lua functions
***********************

Granting the 'execute' privilege on ``lua_call`` permits the user to call any global (accessible via the ``_G`` Lua table)
user-defined Lua function with the ``IPROTO_CALL`` request. To grant permission to any non-persistent function, you need to
specify its name when granting the ``lua_call`` privilege.

.. NOTE::

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.

.. code-block:: lua

function my_func_1() end
function my_func_2() end
box.cfg({listen = 3301})
box.schema.user.create('alice', {password = 'secret'})
conn = require('net.box').connect(box.cfg.listen, {user = 'alice', password = 'secret'})
box.schema.user.grant('alice', 'execute', 'lua_call', 'my_func_1')
conn:call('my_func_1') -- ok
conn:call('my_func_2') -- access denied
box.schema.user.grant('alice', 'execute', 'lua_call', 'box.session.su')
conn:call('box.session.su', {'admin'}) -- ok



Expand Down