diff --git a/doc/user/databases.xml b/doc/user/databases.xml index 0d5a7cd1f94cd2fa9c31a7dc76828caa66efcec2..dc6c65f9f04c1d5fb8ec452e3036b7fd06a09a40 100644 --- a/doc/user/databases.xml +++ b/doc/user/databases.xml @@ -3549,7 +3549,7 @@ The function for dropping a _func tuple is: In the following example, a function named 'f7' is created, then it is put in the _func space, then it is used in a box.schema.user.grant function, then it is dropped: -<programlisting><prompt>tarantool></prompt> <userinput>function f7() session.uid() end</userinput> +<programlisting><prompt>tarantool></prompt> <userinput>function f7() box.session.uid() end</userinput> --- ... <prompt>tarantool></prompt> <userinput>box.schema.func.create('f7')</userinput> @@ -3566,14 +3566,14 @@ box.schema.user.grant function, then it is dropped: ...</programlisting></para> <para> -<bridgehead renderas="sect4">"session=require('session')" and security</bridgehead> +<bridgehead renderas="sect4">"box.session" and security</bridgehead> After a connection has taken place, the user has access to a "session" object which has several functions. The ones which are of interest for security purposes are: -<programlisting>session.uid() #returns the id of the current user -session.user() #returns the name of the current user -session.su(<replaceable>user-name</replaceable>) #allows changing current user to 'user-name'</programlisting></para> +<programlisting>box.session.uid() #returns the id of the current user +box.session.user() #returns the name of the current user +box.session.su(<replaceable>user-name</replaceable>) #allows changing current user to 'user-name'</programlisting></para> <para> If a user types requests directly on the Tarantool server in its interactive mode, @@ -3583,14 +3583,13 @@ many privileges. If a user connects from an application program via one of the <olink targetptr="connectors">connectors</olink>, then the user by default is 'guest' and has few privileges. Typically an admin user will set up and configure objects, then grant privileges to appropriate non-admin users. Typically a guest user will -use <code>session.su()</code> to change into a non-generic user to whom admin +use <code>box.session.su()</code> to change into a non-generic user to whom admin has granted more than the default privileges. For example, admin might say:<programlisting> box.space._user:insert{123456,0,'manager'} box.schema.user.grant('manager', 'read', 'space', '_space') box.schema.user.grant('manager', 'read', 'space', 'payroll')</programlisting> and later a guest user, who wishes to see the payroll, might say:<programlisting> -session = require('session') -session.su('manager') +box.session.su('manager') box.space.payroll:select{'Jones'}</programlisting> </para> diff --git a/doc/user/stored-procedures.xml b/doc/user/stored-procedures.xml index f5ee5a57404697a1aaf3ec5f230e3e3f487c4221..3c8e66755af5e52da157681c1d2014ea89361bf1 100644 --- a/doc/user/stored-procedures.xml +++ b/doc/user/stored-procedures.xml @@ -1502,9 +1502,9 @@ end </section> <section xml:id="sp-box-session"> - <title>Package <code>session</code></title> + <title>Package <code>box.session</code></title> <para> - The <code>session</code> package allows querying the session state, + The <code>box.session</code> package allows querying the session state, writing to a session-specific temporary Lua table, or setting up triggers which will fire when a session starts or ends. A <emphasis>session</emphasis> is an object associated with each client connection. @@ -1512,7 +1512,7 @@ end <variablelist> <varlistentry> <term> - <emphasis role="lua">session.id() </emphasis> + <emphasis role="lua">box.session.id() </emphasis> </term> <listitem> <para> @@ -1525,7 +1525,7 @@ end <varlistentry> <term> - <emphasis role="lua">session.exists(<replaceable>id</replaceable>) </emphasis> + <emphasis role="lua">box.session.exists(<replaceable>id</replaceable>) </emphasis> </term> <listitem> <para> @@ -1537,7 +1537,7 @@ end <varlistentry> <term> - <emphasis role="lua">session.peer(<replaceable>id</replaceable>) </emphasis> + <emphasis role="lua">box.session.peer(<replaceable>id</replaceable>) </emphasis> </term> <listitem> <para> @@ -1555,7 +1555,7 @@ end <varlistentry> <term> - <emphasis role="lua">session.storage</emphasis> + <emphasis role="lua">box.session.storage</emphasis> </term> <listitem> <para> @@ -1569,24 +1569,21 @@ end <para> <bridgehead renderas="sect4">Example</bridgehead><programlisting> -<prompt>tarantool></prompt><userinput> session = require('session')</userinput> ---- -... -<prompt>tarantool></prompt><userinput> session.peer(session.id())</userinput> +<prompt>tarantool></prompt><userinput> box.session.peer(session.id())</userinput> --- - 127.0.0.1:45129 ... -<prompt>tarantool></prompt><userinput> session.storage.random_memorandum = "Don't forget the eggs."</userinput> +<prompt>tarantool></prompt><userinput> box.session.storage.random_memorandum = "Don't forget the eggs."</userinput> --- ... -<prompt>tarantool></prompt><userinput> session.storage.radius_of_mars = 3396</userinput> +<prompt>tarantool></prompt><userinput> box.session.storage.radius_of_mars = 3396</userinput> --- ... <prompt>tarantool></prompt><userinput> m = ''</userinput> --- ... -<prompt>tarantool></prompt><userinput> for k, v in pairs(session.storage) do m = m .. k .. '=' .. v .. ' ' end</userinput> +<prompt>tarantool></prompt><userinput> for k, v in pairs(box.session.storage) do m = m .. k .. '=' .. v .. ' ' end</userinput> --- ... <prompt>tarantool></prompt><userinput> m</userinput> @@ -1596,9 +1593,11 @@ end </para> <para> -See <olink targetptr="sp-box-session-triggers">the section "Triggers on connect and disconnect"</olink> -for instructions about defining triggers for connect and disconnect events - with <code>session.on_connect()</code> and <code>session.on_disconnect()</code>. + See <olink targetptr="sp-box-session-triggers">the section "Triggers on connect and disconnect"</olink> + for instructions about defining triggers for connect and disconnect events + with <code>box.session.on_connect()</code> and <code>box.session.on_disconnect()</code>. + See <olink targetptr="authentication">the section "Authentication and access control"</olink> + for instructions about <code>box.session</code> functions that affect user identification and security. </para> </section> diff --git a/doc/user/triggers.xml b/doc/user/triggers.xml index 4c6d6d8f4a0534f4eba33b2388180c4d8fc85ddb..cafeff29d06a58eced95ad89b9896e5d06a9f60e 100644 --- a/doc/user/triggers.xml +++ b/doc/user/triggers.xml @@ -30,7 +30,7 @@ <variablelist> <varlistentry> <term> - <emphasis role="lua">session.on_connect(chunk) </emphasis> + <emphasis role="lua">box.session.on_connect(chunk) </emphasis> </term> <listitem><para> Set a callback (trigger) for invoking on each connected session. @@ -51,7 +51,7 @@ <varlistentry> <term> - <emphasis role="lua">session.on_disconnect(chunk)</emphasis> + <emphasis role="lua">box.session.on_disconnect(chunk)</emphasis> </term> <listitem><simpara>Set a trigger invoked after a client has disconnected. Returns the old value of the trigger. If