Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
9e5cf04
New translations collectionclass.md (French)
arnaud4d Oct 7, 2025
90a1433
New translations collectionclass.md (Spanish)
arnaud4d Oct 7, 2025
fdd1b05
New translations collectionclass.md (Japanese)
arnaud4d Oct 7, 2025
8d84d50
New translations collectionclass.md (Portuguese, Brazilian)
arnaud4d Oct 7, 2025
462bbf8
New translations collectionclass.md (French)
arnaud4d Oct 7, 2025
815172c
New translations collectionclass.md (Spanish)
arnaud4d Oct 7, 2025
84c3746
New translations collectionclass.md (Japanese)
arnaud4d Oct 7, 2025
400afd9
New translations collectionclass.md (Portuguese, Brazilian)
arnaud4d Oct 7, 2025
77e8b9e
New translations collectionclass.md (French)
arnaud4d Oct 7, 2025
8fe1bdf
New translations collectionclass.md (Spanish)
arnaud4d Oct 7, 2025
fa7e84b
New translations collectionclass.md (Japanese)
arnaud4d Oct 7, 2025
e1dfe3e
New translations collectionclass.md (Portuguese, Brazilian)
arnaud4d Oct 7, 2025
aea5807
New translations sessionclass.md (French)
arnaud4d Oct 7, 2025
0f0dcea
New translations sessionclass.md (Spanish)
arnaud4d Oct 7, 2025
4eb5581
New translations sessionclass.md (Japanese)
arnaud4d Oct 7, 2025
4fb1cbc
New translations sessionclass.md (Portuguese, Brazilian)
arnaud4d Oct 7, 2025
2edb055
New translations clientserver.md (French)
arnaud4d Oct 7, 2025
8754bfe
New translations clientserver.md (Spanish)
arnaud4d Oct 7, 2025
f989b19
New translations clientserver.md (Japanese)
arnaud4d Oct 7, 2025
9384eaa
New translations clientserver.md (Portuguese, Brazilian)
arnaud4d Oct 7, 2025
9a7375f
New translations properties_object.md (French)
arnaud4d Oct 7, 2025
237a6cd
New translations updates.md (French)
arnaud4d Oct 7, 2025
e954bd8
New translations updates.md (Spanish)
arnaud4d Oct 7, 2025
10d8fdb
New translations updates.md (Japanese)
arnaud4d Oct 7, 2025
78ceaf7
New translations updates.md (Portuguese, Brazilian)
arnaud4d Oct 7, 2025
4d25f27
New translations privileges.md (French)
arnaud4d Oct 7, 2025
f689d3b
New translations privileges.md (Spanish)
arnaud4d Oct 7, 2025
938073b
New translations privileges.md (Japanese)
arnaud4d Oct 7, 2025
d1a1477
New translations privileges.md (Portuguese, Brazilian)
arnaud4d Oct 7, 2025
8705b30
New translations sessions.md (French)
arnaud4d Oct 8, 2025
02a3a0e
New translations sessions.md (Spanish)
arnaud4d Oct 8, 2025
58beea8
New translations sessions.md (Japanese)
arnaud4d Oct 8, 2025
b6e328e
New translations sessions.md (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
9aceee2
New translations session.md (French)
arnaud4d Oct 8, 2025
2f02f6c
New translations session.md (Spanish)
arnaud4d Oct 8, 2025
0ea1b9d
New translations session.md (Japanese)
arnaud4d Oct 8, 2025
6ff0f45
New translations session.md (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
7827760
New translations wp-import-document.md (French)
arnaud4d Oct 8, 2025
75e06f5
New translations tcpconnectionclass.md (French)
arnaud4d Oct 8, 2025
f71ac6d
New translations tcpeventclass.md (French)
arnaud4d Oct 8, 2025
52cc120
New translations openaichathelper.md (French)
arnaud4d Oct 8, 2025
00567e1
New translations openaichathelper.md (Spanish)
arnaud4d Oct 8, 2025
319d5ba
New translations openaichathelper.md (Japanese)
arnaud4d Oct 8, 2025
a4cc30a
New translations openaichathelper.md (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
f02e3c4
New translations collectionclass.md (French)
arnaud4d Oct 8, 2025
ccab329
New translations collectionclass.md (Spanish)
arnaud4d Oct 8, 2025
3270ffc
New translations collectionclass.md (Japanese)
arnaud4d Oct 8, 2025
242a27b
New translations collectionclass.md (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
bd4ea6c
New translations sessionclass.md (French)
arnaud4d Oct 8, 2025
8f1e90e
New translations tcpconnectionclass.md (French)
arnaud4d Oct 8, 2025
515fd95
New translations tcpeventclass.md (French)
arnaud4d Oct 8, 2025
d711636
New translations sessionclass.md (Spanish)
arnaud4d Oct 8, 2025
e5bbafc
New translations sessionclass.md (Japanese)
arnaud4d Oct 8, 2025
2c30376
New translations sessionclass.md (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
1d95d48
New translations classes.md (Japanese)
arnaud4d Oct 8, 2025
0084d01
New translations privileges.md (Japanese)
arnaud4d Oct 8, 2025
14c9eda
New translations privileges.md (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
dd21f87
New translations wp-import-document.md (French)
arnaud4d Oct 8, 2025
93cd8d3
New translations udpeventclass.md (French)
arnaud4d Oct 8, 2025
be6b111
New translations collectionclass.md (French)
arnaud4d Oct 8, 2025
dd8c940
New translations collectionclass.md (Spanish)
arnaud4d Oct 8, 2025
1fad004
New translations collectionclass.md (Japanese)
arnaud4d Oct 8, 2025
19b363e
New translations collectionclass.md (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
9be7905
New translations sessionclass.md (French)
arnaud4d Oct 8, 2025
58aa598
New translations sessionclass.md (Spanish)
arnaud4d Oct 8, 2025
0e93820
New translations tcpconnectionclass.md (French)
arnaud4d Oct 8, 2025
724a7b7
New translations tcpeventclass.md (French)
arnaud4d Oct 8, 2025
98be33b
New translations udpeventclass.md (French)
arnaud4d Oct 8, 2025
9922772
New translations sessionclass.md (Japanese)
arnaud4d Oct 8, 2025
1fa7fd4
New translations sessionclass.md (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
a3a05ab
New translations properties_object.md (French)
arnaud4d Oct 8, 2025
efd2847
New translations updates.md (Japanese)
arnaud4d Oct 8, 2025
bd408b7
New translations entities.md (Japanese)
arnaud4d Oct 8, 2025
7244ee4
New translations privileges.md (Japanese)
arnaud4d Oct 8, 2025
5da2435
New translations methods.md (Japanese)
arnaud4d Oct 8, 2025
9d4aa84
New translations privileges.md (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
34c7891
New translations components.md (Japanese)
arnaud4d Oct 8, 2025
fb7e2da
New translations vp-copy-to-object.md (Japanese)
arnaud4d Oct 8, 2025
cd56fd9
New translations vp-find.md (Japanese)
arnaud4d Oct 8, 2025
cce338a
New translations vp-import-document.md (Japanese)
arnaud4d Oct 8, 2025
9fab80d
New translations vp-move-cells.md (Japanese)
arnaud4d Oct 8, 2025
e55f36c
New translations wp-import-document.md (French)
arnaud4d Oct 8, 2025
13bb6bd
New translations zip-create-archive.md (Japanese)
arnaud4d Oct 8, 2025
b7ab122
New translations pict3033006.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
7590076
New translations pict3033008.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
4950133
New translations pict3307937.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
8481ebe
New translations pict3307941.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
43cda60
New translations pict3513503.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
80a1a3a
New translations pict3541581.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
1cfa76b
New translations pict3626363.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
7ffb884
New translations pict3893246.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
2ea938e
New translations pict3893248.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
b1e15be
New translations pict5562054.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
55d46b8
New translations pict5562058.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
54ec0c0
New translations pict5859437.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
89c9cbd
New translations pict5907013.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
975cc50
New translations pict5907021.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
ba18ddb
New translations pict5907023.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
f1b74dd
New translations pict5907026.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
ecff3ed
New translations pict5907030.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
683e99b
New translations pict5941073.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
0c91817
New translations pict6014414.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
2c5b6cb
New translations pict6014426.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
87235fa
New translations pict6014429.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
b386f35
New translations pict6022144.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
7adef27
New translations pict6131919.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
b85305d
New translations pict6421031.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
a9f26b3
New translations pict6421340.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
f9afe00
New translations pict6421342.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
152f84b
New translations pict6421344.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
5843826
New translations pict6421356.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
375e343
New translations pict6434579.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
62549ab
New translations pict6434721.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
ab7f8a7
New translations pict6434723.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
663cfa7
New translations pict6441966.en.png (Portuguese, Brazilian)
arnaud4d Oct 8, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -3148,12 +3148,13 @@ Soporte de fórmula

</details>

<!-- REF #collection.sort().Syntax -->**.sort**() : Collection<br/>**.sort**( *formula* : 4D.Function { ; *...extraParam* : any } ) : Collection<br/>**.sort**( *methodName* : Text { ; *...extraParam* : any } ) : Collection <!-- END REF -->
<!-- REF #collection.sort().Syntax -->**.sort**() : Collection<br/>**.sort**( *ascOrDesc* : Integer ) : Collection <br/>**.sort**( *formula* : 4D.Function { ; *...extraParam* : any } ) : Collection<br/>**.sort**( *methodName* : Text { ; *...extraParam* : any } ) : Collection<!-- END REF -->

<!-- REF #collection.sort().Params -->

| Parámetros | Tipo | | Descripción |
| ---------- | --------------------------- | :-------------------------: | --------------------- |
| ascOrDesc | Integer | -> | Ejemplo 1 |
| formula | 4D.Function | -> | Objeto fórmula |
| methodName | Text | -> | Nombre de un método |
| extraParam | any | -> | Parámetros del método |
Expand All @@ -3167,7 +3168,19 @@ La función `.sort()` <!-- REF #collection.sort().Summary -->ordena los elemento

> Esta función modifica la colección original.

Si se llama a `.sort()` sin parámetros, sólo se ordenan los valores escalares (número, texto, fecha, booleanos). Los elementos se ordenan por defecto de forma ascendente, según su tipo. Si la colección contiene elementos de diferentes tipos, se agrupan primero por tipo y se ordenan después. Si <em x-id="3">attributePath</em> lleva a una propiedad de objeto que contiene valores de diferentes tipos, primero se agrupan por tipo y se ordenan después.
Si se llama a `.sort()` sin parámetros, sólo se ordenan los valores escalares (número, texto, fecha, booleanos). Los elementos se ordenan por defecto de forma ascendente, según su tipo.
You can also pass one of the following constants in the *ascOrDesc* parameter:

```
|Constant| Type|Value|Comment|
|---|---|---|---|
|ck ascending|Integer|0|Elements are ordered in ascending order (default)|
|ck descending|Integer|1|Elements are ordered in descending order|

This syntax orders scalar values in the collection only (other element types such as objects or collections are returned unordered).
```

Si la colección contiene elementos de diferentes tipos, se agrupan primero por tipo y se ordenan después. Si <em x-id="3">attributePath</em> lleva a una propiedad de objeto que contiene valores de diferentes tipos, primero se agrupan por tipo y se ordenan después.

1. null
2. booleans
Expand Down
71 changes: 43 additions & 28 deletions i18n/es/docusaurus-plugin-content-docs/current/API/SessionClass.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ La disponibilidad de las propiedades y funciones del objeto `Session` depende de

<details><summary>Historia</summary>

| Lanzamiento | Modificaciones |
| ----------- | -------------- |
| 18 R6 | Añadidos |
| Lanzamiento | Modificaciones |
| ----------- | -------------------------- |
| 21 | Support of remote sessions |
| 18 R6 | Añadidos |

</details>

Expand All @@ -74,7 +75,7 @@ La disponibilidad de las propiedades y funciones del objeto `Session` depende de

:::note

Esta función no hace nada y siempre devuelve **True** con cliente remoto, procedimiento almacenado y sesiones independientes.
This function does nothing and always returns **True** with stored procedure sessions and standalone sessions.

:::

Expand All @@ -88,6 +89,8 @@ Esta función no elimina los **privilegios promovidos** del proceso web, tanto s

:::

Regarding remote client sessions, the function only impacts [code accessing the web server](../WebServer/preemptiveWeb.md#writing-thread-safe-web-server-code).

#### Ejemplo

```4d
Expand All @@ -107,9 +110,10 @@ $isGuest:=Session.isGuest() //$isGuest es True

<details><summary>Historia</summary>

| Lanzamiento | Modificaciones |
| ----------- | -------------- |
| 20 R9 | Añadidos |
| Lanzamiento | Modificaciones |
| ----------- | -------------------------- |
| 21 | Support of remote sessions |
| 20 R9 | Añadidos |

</details>

Expand All @@ -120,25 +124,30 @@ $isGuest:=Session.isGuest() //$isGuest es True
| Parámetros | Tipo | | Descripción |
| ---------- | ------- | :-------------------------: | --------------------------------------------------- |
| lifespan | Integer | -> | Duración de la vida del token de sesión en segundos |
| Resultado | Text | <- | UUID de la sesión |
| Resultado | Text | <- | UUID of the token |

<!-- END REF -->

#### Descripción

:::note

Esta función solo está disponible con sesiones usuario web. Devuelve una cadena vacía en otros contextos.
This function is available with web user sessions and remote sessions. It returns an empty string in stored procedure and standalone sessions.

:::

La función `.createOTP()` <!-- REF #SessionClass.createOTP().Summary -->crea un nuevo OTP (One Time Passcode) para la sesión y devuelve su token UUID<!-- END REF -->. Este token es único en la sesión en la que fue generado.

Para más información sobre los tokens OTP, por favor consulte [esta sección](../WebServer/sessions.md#session-token-otp).

Por defecto, si se omite el parámetro *lifespan*, el token se crea con el mismo tiempo de vida que el [`.idleTimeOut`](#idletimeout) de la sesión. Puede definir un tiempo de espera personalizado pasando un valor en segundos en *lifespan*. Si se utiliza un token caducado para restaurar una sesión de usuario web, se ignora.
Puede definir un tiempo de espera personalizado pasando un valor en segundos en *lifespan*. If an expired token is used to restore a session, it is ignored. By default, if the *lifespan* parameter is omitted:

- with web user sessions, the token is created with the same lifespan as the [`.idleTimeOut`](#idletimeout) of the session.
- with remote sessions, the token is created with a 10 seconds lifespan.

El token devuelto puede ser utilizado en intercambios con aplicaciones de terceros o sitios web para identificar la sesión de forma segura. Por ejemplo, el token OTP de sesión se puede utilizar con una aplicación de pago.
For **web user sessions**, the returned token can be used in exchanges with third-party applications or websites to securely identify the session. Por ejemplo, el token OTP de sesión se puede utilizar con una aplicación de pago.

For **remote sessions**, the returned token can be used on 4D Server to identitfy requests coming from a [remote 4D running Qodly forms in a Web area](../Desktop/clientServer.md#remote-user-sessions).

#### Ejemplo

Expand Down Expand Up @@ -253,9 +262,10 @@ $expiration:=Session.expirationDate //eg "2021-11-05T17:10:42Z"

<details><summary>Historia</summary>

| Lanzamiento | Modificaciones |
| ----------- | -------------- |
| 20 R6 | Añadidos |
| Lanzamiento | Modificaciones |
| ----------- | --------------------------------- |
| 21 | Support of remote client sessions |
| 20 R6 | Añadidos |

</details>

Expand All @@ -279,7 +289,9 @@ Esta función devuelve los privilegios asignados a una Sesión utilizando única

:::

Con clientes remotos, procedimientos almacenados y sesiones independientes, esta función devuelve una colección que sólo contiene "WebAdmin".
With remote client sessions, the privileges only concerns the code executed in the context of a [web request sent through a Web area](../Desktop/clientServer.md#sharing-the-session-with-qodly-pages-in-web-areas).

With stored procedure sessions and standalone sessions, this function returns a collection only containing "WebAdmin".

#### Ejemplo

Expand Down Expand Up @@ -348,10 +360,10 @@ $privileges := Session.getPrivileges()

<details><summary>Historia</summary>

| Lanzamiento | Modificaciones |
| ----------- | --------------------------------------------- |
| 21 | Devuelve True para los privilegios promovidos |
| 18 R6 | Añadidos |
| Lanzamiento | Modificaciones |
| ----------- | ----------------------------------------------------------------------- |
| 21 | Returns True for promoted privileges, Support of remote client sessions |
| 18 R6 | Añadidos |

</details>

Expand All @@ -376,7 +388,9 @@ Esta función devuelve True para el *privilegio* si se llama desde una función

:::

Con cliente remoto, procedimientos almacenados y sesiones independientes, esta función siempre devuelve True, sea cual sea el *privilege*.
Regarding remote client sessions, the function only impacts [code accessing the web server](../WebServer/preemptiveWeb.md#writing-thread-safe-web-server-code).

With stored procedure sessions and standalone sessions, this function always returns True, whatever the *privilege*.

#### Ejemplo

Expand Down Expand Up @@ -717,6 +731,7 @@ Function callback($request : 4D.IncomingMessage) : 4D.OutgoingMessage

| Lanzamiento | Modificaciones |
| ----------- | --------------------------------------------------- |
| 21 | Support of remote client sessions |
| 19 R8 | Compatibilidad con la propiedad "roles" en Settings |
| 18 R6 | Añadidos |

Expand All @@ -739,23 +754,21 @@ Function callback($request : 4D.IncomingMessage) : 4D.OutgoingMessage

:::note

Esta función no hace nada y siempre devuelve **False** con cliente remoto, procedimiento almacenado y sesiones independientes.
This function does nothing and always returns **False** with stored procedure sessions and standalone sessions.

:::

La función `.setPrivileges()` <!-- REF #SessionClass.setPrivileges().Summary -->asocia a la sesión los privilegios y/o roles definidos en el parámetro y devuelve **True** si la ejecución se ha realizado correctamente<!-- END REF -->.

- En el parámetro *privilege*, pase una cadena que contenga un nombre de privilegio (o varios nombres de privilegio separados por comas).

- En el parámetro *privileges*, pase una colección de cadenas que contengan nombres de privilegios.

- En el parámetro *settings*, pase un objeto que contenga las siguientes propiedades:

| Propiedad | Tipo | Descripción |
| ---------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------- |
| privileges | Text o Collection | <li>Cadena que contiene un nombre de privilegio, o</li><li>Colección de cadenas que contienen nombres de privilegios</li> |
| roles | Text o Collection | <li>Cadena que contiene un rol, o</li><li>Colección de cadenas que contienen roles</li> |
| userName | Text | Nombre de usuario para asociar a la sesión (opcional) |
| Propiedad | Tipo | Descripción |
| ---------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| privileges | Text o Collection | <li>Cadena que contiene un nombre de privilegio, o</li><li>Colección de cadenas que contienen nombres de privilegios</li> |
| roles | Text o Collection | <li>Cadena que contiene un rol, o</li><li>Colección de cadenas que contienen roles</li> |
| userName | Text | User name to associate to the session (optional, web sessions only). Not available in remote client sessions (ignored). |

:::note

Expand All @@ -769,6 +782,8 @@ Por defecto, cuando no hay ningún privilegio o rol asociado a la sesión, la se

La propiedad [`userName`](#username) está disponible a nivel de objeto de sesión (sólo lectura).

Regarding remote client sessions, the function only concerns the code executed in the context of a [web request sent through a Web area](../Desktop/clientServer.md#sharing-the-session-with-qodly-pages-in-web-areas).

#### Ejemplo

En un método de autenticación personalizado, se establece el privilegio "WebAdmin" para el usuario:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,19 @@ Sin embargo, debe prestar atención a las siguientes diferencias de comportamien

En el servidor, el comando [`Session`](../commands/session.md) devuelve un objeto `session` que describe la sesión de usuario actual. Este objeto se maneja a través de las funciones y propiedades de la [clase `Session`](../API/SessionClass.md).

:::tip Entradas de blog relacionadas

[Objeto sesión remota 4D con conexión cliente/servidor y procedimiento almacenado](https://blog.4d.com/new-4D-remote-session-object-with-client-server-connection-and-stored-procedure).

:::

### Utilización

El objeto `session` permite obtener información sobre la sesión del usuario remoto. Puede compartir datos entre todos los procesos de la sesión del usuario utilizando el objeto compartido [`session.storage`](../API/SessionClass.md#storage).
The `session` object allows you to handle information and privileges for the remote user session.

Puede compartir datos entre todos los procesos de la sesión del usuario utilizando el objeto compartido [`session.storage`](../API/SessionClass.md#storage). Por ejemplo, puede iniciar un procedimiento de autenticación y verificación de usuario cuando un cliente se conecta al servidor, que involucra ingresar un código enviado por correo electrónico o SMS en la aplicación. A continuación, añada la información de usuario al almacenamiento de sesión, permitiendo al servidor identificar al usuario. De este modo, el servidor 4D puede acceder a la información del usuario para todos los procesos del cliente, lo que permite escribir código personalizado según el rol del usuario.

Por ejemplo, puede iniciar un procedimiento de autenticación y verificación de usuario cuando un cliente se conecta al servidor, que involucra ingresar un código enviado por correo electrónico o SMS en la aplicación. A continuación, añada la información de usuario al almacenamiento de sesión, permitiendo al servidor identificar al usuario. De este modo, el servidor 4D puede acceder a la información del usuario para todos los procesos del cliente, lo que permite escribir código personalizado según el rol del usuario.
You can also assign privileges to a remote user session to control access when the session comes from Qodly pages running in web areas.

### Disponibilidad

Expand All @@ -110,7 +118,60 @@ Todos los procedimientos almacenados en el servidor comparten la misma sesión d

:::

### Ver también (entrada de blog)
### Sharing the session with Qodly pages in Web areas

[Objeto sesión remota 4D con conexión cliente/servidor y procedimiento almacenado](https://blog.4d.com/new-4D-remote-session-object-with-client-server-connection-and-stored-procedure).
Remote client sessions can be used to handle Client/Server applications where [Qodly pages](https://developer.4d.com/qodly/4DQodlyPro/pageLoaders/pageLoaderOverview) are used for the interface, running on remote machines. With this configuration, your applications have modern CSS-based web interfaces but still benefit from the power and simplicity of integrated client/server development. In such applications, Qodly pages are executed within standard 4D [Web areas](../FormObjects/webArea_overview.md).

To manage this configuration, you need to use remote client sessions. Actually, requests coming from both the remote 4D application and its Qodly pages loaded in Web areas need to work inside a single user session. You just have to share the same session between the remote client and its web pages so that you can have the same [session storage](../API/SessionClass.md#storage) and client license, whatever the request origin.

Note that [privileges](../ORDA/privileges.md) should be set in the session before executing a web request from a Web area, so that the user automatically gets their privileges for web access (see example). Keep in mind that privileges only apply to requests coming from the web, not to the 4D code executed in a standard remote session.

Shared sessions are handled through [OTP tokens](../WebServer/sessions.md#session-token-otp). After you created an OTP token on the server for the user session, you add the token (through the `$4DSID` parameter value) to web requests sent from web areas containing Qodly pages so that the user session on the server is identified and shared. On the web server side, if a web request contains an *OTP id* in the $4DSID parameter, the session corresponding to this OTP token is used.

:::tip Entrada de blog relacionada

[Share your 4D remote client session with web accesses](https://blog.4d.com/share-your-4d-remote-client-session-with-web-accesses)

:::

#### Ejemplo

```4d
var $otp : Text

// Some privileges are put in the remote user session on the server for a further web access
ds.resetPrivileges("basic")

// An OTP is created on the server for this remote client session
$otp:=ds.getOTP()


// The user has already the required privileges for a web access
// and the same session is shared between this remote user and the web Qodly app
WA OPEN URL(*; "Welcome"; "http://127.0.0.1/$lib/renderer/?w=People&$4DSID="+$otp)

```

*resetPrivileges()* function in the Datastore class:

```4d
// This function is run on the server
// and puts some privileges in the session for a further web access

exposed Function resetPrivileges($priv : Text)

Session.clearPrivileges()
Session.setPrivileges($priv)
```

*getOTP()* function in the Datastore class:

```4d
// This function is run on the server
// and generates an OTP able to retrieve this remote user session

exposed Function getOTP(): Text

return Session.createOTP()

```
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Lea [**Novedades en 4D 21**](https://blog.4d.com/en-whats-new-in-4d-21/), la ent
- Support of **AI Vector Searches** in the [`query()`](../API/DataClassClass.md#query-by-vector-similarity) function and in the [`$filter`](../REST/$filter.md#vector-similarity) REST API.
- Support of TLS encryption for the [4D.TCPConnection](../API/TCPConnectionClass.md#4dtcpconnectionnew) class.
- New option allowing to use certificates from Windows Certificate Store instead of a local certificates folder in [`HTTPRequest`](../API/HTTPRequestClass.md#4dhttprequestnew) and [`HTTPAgent`](../API/HTTPAgentClass.md#4dhttpagentnew) classes.
- In client/server applications, use Qodly pages in Web areas and [share the remote client session](../Desktop/clientServer.md#sharing-the-session-with-qodly-pages-in-web-areas).
- You can now [create components directly from the host project](../Extensions/develop-components.md#creating-components) and [edit their code from a dedicated tab](../Extensions/develop-components.md#editing-all-component-code) in the 4D Explorer without leaving or restarting the project.
- The 4D product activation step has been simplified and automated during [sign-in](../GettingStarted/Installation.md#sign-in).
- 4D AIKit component: new features to [invoke a specific tool automatically](../aikit/Classes/OpenAIChatHelper.md#registertool) and [specify a response format](../aikit/Classes/OpenAIChatCompletionsParameters.md#response-format).
Expand Down
Loading
Loading