box.session.euid() | Tarantool

box.session.euid()

box.session.euid()
Return:the effective user ID of the current user.

The system uses the effective user ID to determine the process’s permissions at any given moment. This is the same as box.session.uid(), except two cases:

  • box.session.euid() is called within a function invoked by box.session.su(). In this case:

    • box.session.euid() returns the ID of the changed user

    (the user who is specified by the user-name parameter of the box.session.su() function). - box.session.uid() returns the ID of the original user (the user who calls the box.session.su() function).

  • box.session.euid() is called within a function specified with box.schema.func.create(function-name, {setuid= true}) and the binary protocol is in use. In this case:

    • box.session.euid() returns the ID of the user who created function-name.
    • box.session.uid() returns the ID of the user who calls function-name.
Rtype:number

Example:

tarantool> box.session.su('admin')
---
...
tarantool> box.session.uid(), box.session.euid()
---
- 1
- 1
...
tarantool> function f() return {box.session.uid(),box.session.euid()} end
---
...
tarantool> box.session.su('guest', f)
---
- - 1
  - 0
...
Found what you were looking for?
Feedback