Skip to content

Commit

Permalink
Merge pull request #365 from doc4d/main
Browse files Browse the repository at this point in the history
update other lang
  • Loading branch information
arnaud4d authored Oct 15, 2024
2 parents b089742 + 01b2fb9 commit 23da837
Show file tree
Hide file tree
Showing 6,183 changed files with 27,719 additions and 28,452 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions docs/Concepts/classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Available classes are accessible from their class stores. Two class stores are a
<!-- REF #_command_.cs.Params -->
|Parameter|Type||Description|
|---|---|---|---|
|classStore|Object|<-|User class store for the project or component|<!-- END REF -->
|classStore|Object|&larr;|User class store for the project or component|<!-- END REF -->

The `cs` command <!-- REF #_command_.cs.Summary -->returns the user class store for the current project or component<!-- END REF -->. It returns all user classes [defined](#class-definition) in the opened project or component. By default, only project [ORDA classes](ORDA/ordaClasses.md) are available.

Expand All @@ -136,7 +136,7 @@ $instance:=cs.myClass.new()
<!-- REF #_command_.4D.Params -->
|Parameter|Type||Description|
|---|---|---|---|
|classStore|Object|<-|4D class store|<!-- END REF -->
|classStore|Object|&larr;|4D class store|<!-- END REF -->

The `4D` command <!-- REF #_command_.4D.Summary -->returns the class store for available built-in 4D classes<!-- END REF -->. It provides access to specific APIs such as [CryptoKey](API/CryptoKeyClass.md).

Expand Down
3 changes: 2 additions & 1 deletion docs/Notes/updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Read [**What’s new in 4D 20 R7**](https://blog.4d.com/en-whats-new-in-4d-v20-R

#### Behavior changes

- Compiler directive commands (`C_XXX`) are now deprecated and have been renamed `_O_C_XXX` (for example, `C_TEXT` has been renamed `_O_C_TEXT`).
- Documentations for [4D Language](../commands/command-index.md) and [4D Write Pro Language](../WritePro/commands/command-index.md) are now fully available on developer.4d.com. Find out about all the new features and changes concerning these documentations in this release note.
- Compiler directive commands (`C_XXX`) are now deprecated and have been renamed `_O_C_XXX` (for example, `C_TEXT` has been renamed `_O_C_TEXT`).


## 4D 20 R6
Expand Down Expand Up @@ -62,6 +62,7 @@ Read [**What’s new in 4D 20 R6**](https://blog.4d.com/en-whats-new-in-4d-20-R6

Read [**What’s new in 4D 20 R5**](https://blog.4d.com/en-whats-new-in-4d-20-R5/), the blog post that lists all new features and enhancements in 4D 20 R5.


#### Highlights

- New [Component manager](../Project/components.md) to handle components through a `dependencies.json` file.
Expand Down
25 changes: 4 additions & 21 deletions docs/REST/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,16 @@ The warning message "Caution, check the access privileges" is displayed when you

## Controlling REST access

By default, REST accesses are open to all users which is obviously not recommended for security reasons, and also to control client licenses usage.
By default, REST accesses are open to all users which is obviously not recommended for security reasons, and also to control client licenses usage.

You can configure REST accesses with one of the following means:
- (recommended) enable the **force login** mode and create an [`authentify()`](authUsers.md#authentify) datastore class function to authenticate users and assign privileges to their web session (see [User login modes](authUsers.md#user-login-modes)).
- assign a **Read/Write** user group to REST services in the "**Web** > **Web Features**" page of the Structure Settings;
- write an `On REST Authentication` database method to intercept and handle every initial REST request.
As of 4D 20 R6, you configure REST accesses by enabling the [**force login** mode](authUsers.md#force-login-mode) and create an [`authentify()`](authUsers.md#authentify) datastore class function to authenticate users and assign privileges to their web session.

:::note Compatibility

:::info Important

- It is recommended not to enable different REST access control features simultaneously to avoid conflicts.
- If an `On REST Authentication` database method has been defined, any setting made using the "Read/Write" menu on the **Web** > **Web Features** page of the Structure Settings is ignored.
The **Access** area in the Settings dialog box is only available in converted projects for compatibility. See [Access](../settings/web.md#access) for more information.

:::

### Using the Structure Settings

The **Read/Write** menu in the "**Web** > **Web Features**" page of the structure settings specifies a group of 4D users that is authorized to establish the link to the 4D application using REST queries.

By default, the menu displays `\<Anyone>`, which means that REST accesses are open to all users. Once you have specified a group, only a 4D user account that belongs to this group may be used to [access 4D by means of a REST request](authUsers.md). If an account is used that does not belong to this group, 4D returns an authentication error to the sender of the request.

> In order for this setting to take effect, the `On REST Authentication` database method must not be defined. If it exists, 4D ignores access settings defined in the Structure Settings.
### Using the On REST Authentication database method
The `On REST Authentication` database method provides you with a custom way of controlling the opening of REST sessions on 4D. This database method is automatically called when a new session is opened through a REST request. When a [request to open a REST session](authUsers.md) is received, the connection identifiers are provided in the header of the request. The `On REST Authentication` database method is called so that you can evaluate these identifiers. You can use the list of users for the 4D application or you can use your own table of identifiers.
For more information, refer to the `On REST Authentication` database method [documentation](https://doc.4d.com/4Dv18/4D/18/On-REST-Authentication-database-method.301-4505004.en.html).



## Exposing tables and fields
Expand Down
88 changes: 42 additions & 46 deletions docs/WebServer/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ds.webUser.save()

See also [this example](gettingStarted.md#authenticating-users) from the "Getting started" chapter.

If no custom authentication is provided, 4D calls the [`On Web Authentication`](#on-web-authentication) database method (if it exists). In addition to $1 and $2, only the IP addresses of the browser and the server ($3 and $4) are provided, the user name and password ($5 and $6) are empty. The method must return **True** in $0 if the user is successfully authenticated, then the resquested resource is served, or **False** in $0 if the authentication failed.
If no custom authentication is provided, 4D calls the [`On Web Authentication`](#on-web-authentication) database method (if it exists). In addition to $urll and $content, only the IP addresses of the browser and the server ($IPClient and $IPServer) are provided, the user name and password ($user and $password) are empty. The method must return **True** in $0 if the user is successfully authenticated, then the resquested resource is served, or **False** in $0 if the authentication failed.

> **Warning:** If the `On Web Authentication` database method does not exist, connections are automatically accepted (test mode).
Expand All @@ -65,7 +65,7 @@ Entered values are then evaluated:

This mode provides a greater level of security since the authentication information is processed by a one-way process called hashing which makes their contents impossible to decipher.

As in BASIC mode, users must enter their name and password when they connect. The [`On Web Authentication`](#on-web-authentication) database method is then called. When the DIGEST mode is activated, the $6 parameter (password) is always returned empty. In fact, when using this mode, this information does not pass by the network as clear text (unencrypted). It is therefore imperative in this case to evaluate connection requests using the `WEB Validate digest` command.
As in BASIC mode, users must enter their name and password when they connect. The [`On Web Authentication`](#on-web-authentication) database method is then called. When the DIGEST mode is activated, the $password parameter (password) is always returned empty. In fact, when using this mode, this information does not pass by the network as clear text (unencrypted). It is therefore imperative in this case to evaluate connection requests using the `WEB Validate digest` command.

>You must restart the web server in order for the changes made to these parameters to be taken into account.
Expand All @@ -89,102 +89,98 @@ The `On Web Authentication` database method is therefore called:
The `On Web Authentication` database method is NOT called:

- when the web server receives a URL requesting a valid static page.
- when the web server reveives a URL beginning with `rest/` and the REST server is launched (in this case, the authentication is handled through the [`On REST Authentication` database method](REST/configuration.md#using-the-on-rest-authentication-database-method) or [Structure settings](REST/configuration.md#using-the-structure-settings)).
- when the web server receives a URL beginning with `rest/` and the REST server is launched (in this case, the authentication is handled through the [`ds.authentify` function](../REST/authUsers#force-login-mode) or (deprecated) the [`On REST Authentication` database method](REST/configuration.md#using-the-on-rest-authentication-database-method) or [Structure settings](REST/configuration.md#using-the-structure-settings)).


### Syntax

**On Web Authentication**( *$1* : Text ; *$2* : Text ; *$3* : Text ; *$4* : Text ; *$5* : Text ; *$6* : Text ) -> $0 : Boolean
**On Web Authentication**( *$url* : Text ; *$content* : Text ; *$IPClient* : Text ; *$IPServer* : Text ; *$user* : Text ; *$password* : Text ) -> $accept : Boolean

|Parameters|Type||Description|
|---|---|:---:|---|
|$1|Text|<-|URL |
|$2|Text|<-|HTTP headers + HTTP body (up to 32 kb limit) |
|$3|Text|<-|IP address of the web client (browser) |
|$4|Text|<-|IP address of the server |
|$5|Text|<-|User name |
|$6|Text|<-|Password |
|$0|Boolean|->|True = request accepted, False = request rejected|
|$url|Text|<-|URL |
|$content|Text|<-|HTTP headers + HTTP body (up to 32 kb limit) |
|$IPClient|Text|<-|IP address of the web client (browser) |
|$IPServer|Text|<-|IP address of the server |
|$user|Text|<-|User name |
|$password|Text|<-|Password |
|$accept|Boolean|->|True = request accepted, False = request rejected|

You must declare these parameters as follows:

```4d
//On Web Authentication database method
C_TEXT($1;$2;$3;$4;$5;$6)
C_BOOLEAN($0)
//Code for the method
```

Alternatively, you can use the [named parameters](Concepts/parameters.md#named-parameters) syntax:

```4d
// On Web Authentication database method
#DECLARE ($url : Text; $header : Text; \
$BrowserIP : Text; $ServerIP : Text; \
#DECLARE ($url : Text; $content : Text; \
$IPClient : Text; $IPServer : Text; \
$user : Text; $password : Text) \
-> $RequestAccepted : Boolean
-> $accept : Boolean
//Code for the method
```

>All the `On Web Authentication` database method's parameters are not necessarily filled in. The information received by the database method depends on the selected [authentication mode](#authentication-mode)).
:::note

All the `On Web Authentication` database method's parameters are not necessarily filled in. The information received by the database method depends on the selected [authentication mode](#authentication-mode)).

:::

#### $1 - URL
#### $url - URL

The first parameter (`$1`) is the URL received by the server, from which the host address has been removed.
The first parameter (`$url`) is the URL received by the server, from which the host address has been removed.

Let’s take the example of an Intranet connection. Suppose that the IP address of your 4D Web Server machine is 123.45.67.89. The following table shows the values of $1 depending on the URL entered in the Web browser:
Let’s take the example of an Intranet connection. Suppose that the IP address of your 4D Web Server machine is 123.45.67.89. The following table shows the values of $urll depending on the URL entered in the Web browser:

|URL entered in web browser|Value of parameter $1|
|URL entered in web browser|Value of parameter $urll|
|---|---|
|123.45.67.89|/ |
|http://123.45.67.89|/ |
|123.45.67.89/Customers|/Customers |
|http://123.45.67.89/Customers/Add|/Customers/Add |
|123.45.67.89/Do_This/If_OK/Do_That|/Do_This/If_OK/Do_That |

#### $2 - Header and Body of the HTTP request
#### $content - Header and Body of the HTTP request

The second parameter (`$2`) is the header and the body of the HTTP request sent by the web browser. Note that this information is passed to your `On Web Authentication` database method as it is. Its contents will vary depending on the nature of the web browser which is attempting the connection.
The second parameter (`$content`) is the header and the body of the HTTP request sent by the web browser. Note that this information is passed to your `On Web Authentication` database method as it is. Its contents will vary depending on the nature of the web browser which is attempting the connection.

If your application uses this information, it is up to you to parse the header and the body. You can use the `WEB GET HTTP HEADER` and the `WEB GET HTTP BODY` commands.

>For performance reasons, the size of data passing through the $2 parameter must not exceed 32 KB. Beyond this size, they are truncated by the 4D HTTP server.
>For performance reasons, the size of data passing through the $content parameter must not exceed 32 KB. Beyond this size, they are truncated by the 4D HTTP server.
#### $3 - Web client IP address
#### $IPClient - Web client IP address

The `$3` parameter receives the IP address of the browser’s machine. This information can allow you to distinguish between intranet and internet connections.
The `$IPClient` parameter receives the IP address of the browser’s machine. This information can allow you to distinguish between intranet and internet connections.

>4D returns IPv4 addresses in a hybrid IPv6/IPv4 format written with a 96-bit prefix, for example ::ffff:192.168.2.34 for the IPv4 address 192.168.2.34. For more information, refer to the [IPv6 Support](webServerConfig.md#about-ipv6-support) section.

#### $4 - Server IP address
#### $IPServer - Server IP address

The `$4` parameter receives the IP address used to call the web server. 4D allows for multi-homing, which allows you to exploit machines with more than one IP address. For more information, please refer to the [Configuration page](webServerConfig.md#ip-address-to-listen).
The `$IPServer` parameter receives the IP address used to call the web server. 4D allows for multi-homing, which allows you to exploit machines with more than one IP address. For more information, please refer to the [Configuration page](webServerConfig.md#ip-address-to-listen).


#### $5 and $6 - User Name and Password
#### $user and $password - User Name and Password

The `$5` and `$6` parameters receive the user name and password entered by the user in the standard identification dialog box displayed by the browser. This dialog box appears for each connection, if [basic](#basic-protocol) or [digest](#digest-protocol) authentication is selected.
The `$user` and `$password` parameters receive the user name and password entered by the user in the standard identification dialog box displayed by the browser. This dialog box appears for each connection, if [basic](#basic-protocol) or [digest](#digest-protocol) authentication is selected.

>If the user name sent by the browser exists in 4D, the $6 parameter (the user’s password) is not returned for security reasons.
>If the user name sent by the browser exists in 4D, the $password parameter (the user’s password) is not returned for security reasons.
#### $0 parameter
#### $accept - Function return

The `On Web Authentication` database method returns a boolean in $0:
The `On Web Authentication` database method returns a boolean:

* If $0 is True, the connection is accepted.
* If it is True, the connection is accepted.

* If $0 is False, the connection is refused.
* If it is False, the connection is refused.

The `On Web Connection` database method is only executed if the connection has been accepted by `On Web Authentication`.

>**WARNING**<br/>If no value is set to $0 or if $0 is not defined in the `On Web Authentication` database method, the connection is considered as accepted and the `On Web Connection` database method is executed.
:::warning

>* Do not call any interface elements in the `On Web Authentication` database method (`ALERT`, `DIALOG`, etc.) because otherwise its execution will be interrupted and the connection refused. The same thing will happen if an error occurs during its processing.
- If no value is returned, the connection is considered as **accepted** and the `On Web Connection` database method is executed.
- Do not call any interface elements in the `On Web Authentication` database method (`ALERT`, `DIALOG`, etc.) because otherwise its execution will be interrupted and the connection refused. The same thing will happen if an error occurs during its processing.

:::

### Example

Expand Down
6 changes: 3 additions & 3 deletions docs/WritePro/commands-legacy/wp-add-picture.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ displayed_sidebar: docs
<!--REF #_command_.WP Add picture.Params-->
| Parameter | Type | | Description |
| --- | --- | --- | --- |
| wpDoc | Object | &#x1F852; | 4D Write Pro document |
| picture | Picture, Text | &#x1F852; | Picture or Picture path |
| Function result | Object | &#x1F850; | Object referencing the picture |
| wpDoc | Object | &rarr; | 4D Write Pro document |
| picture | Picture, Text | &rarr; | Picture or Picture path |
| Function result | Object | &larr; | Object referencing the picture |

<!-- END REF-->

Expand Down
6 changes: 3 additions & 3 deletions docs/WritePro/commands-legacy/wp-bookmark-range.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ displayed_sidebar: docs
<!--REF #_command_.WP Bookmark range.Params-->
| Parameter | Type | | Description |
| --- | --- | --- | --- |
| wpDoc | Object | &#x1F852; | 4D Write Pro document |
| bkName | Text | &#x1F852; | Name of bookmark whose range you want to get |
| Function result | Object | &#x1F850; | Range of bookmark |
| wpDoc | Object | &rarr; | 4D Write Pro document |
| bkName | Text | &rarr; | Name of bookmark whose range you want to get |
| Function result | Object | &larr; | Range of bookmark |

<!-- END REF-->

Expand Down
2 changes: 1 addition & 1 deletion docs/WritePro/commands-legacy/wp-compute-formulas.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ displayed_sidebar: docs
<!--REF #_command_.WP COMPUTE FORMULAS.Params-->
| Parameter | Type | | Description |
| --- | --- | --- | --- |
| targetObj | Object | &#x1F852; | Range or element or 4D Write Pro document |
| targetObj | Object | &rarr; | Range or element or 4D Write Pro document |

<!-- END REF-->

Expand Down
4 changes: 2 additions & 2 deletions docs/WritePro/commands-legacy/wp-delete-bookmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ displayed_sidebar: docs
<!--REF #_command_.WP DELETE BOOKMARK.Params-->
| Parameter | Type | | Description |
| --- | --- | --- | --- |
| wpDoc | Object | &#x1F852; | 4D Write Pro document |
| bkName | String | &#x1F852; | Name of bookmark to delete |
| wpDoc | Object | &rarr; | 4D Write Pro document |
| bkName | String | &rarr; | Name of bookmark to delete |

<!-- END REF-->

Expand Down
2 changes: 1 addition & 1 deletion docs/WritePro/commands-legacy/wp-delete-footer.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ displayed_sidebar: docs
<!--REF #_command_.WP DELETE FOOTER.Params-->
| Parameter | Type | | Description |
| --- | --- | --- | --- |
| wpSection | Object | &#x1F852; | 4D Write Pro section or subsection |
| wpSection | Object | &rarr; | 4D Write Pro section or subsection |

<!-- END REF-->

Expand Down
2 changes: 1 addition & 1 deletion docs/WritePro/commands-legacy/wp-delete-header.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ displayed_sidebar: docs
<!--REF #_command_.WP DELETE HEADER.Params-->
| Parameter | Type | | Description |
| --- | --- | --- | --- |
| wpSection | Object | &#x1F852; | 4D Write Pro section or subsection |
| wpSection | Object | &rarr; | 4D Write Pro section or subsection |

<!-- END REF-->

Expand Down
2 changes: 1 addition & 1 deletion docs/WritePro/commands-legacy/wp-delete-picture.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ displayed_sidebar: docs
<!--REF #_command_.WP DELETE PICTURE.Params-->
| Parameter | Type | | Description |
| --- | --- | --- | --- |
| imgObj | Object | &#x1F852; | Image object (inline or anchored) |
| imgObj | Object | &rarr; | Image object (inline or anchored) |

<!-- END REF-->

Expand Down
6 changes: 3 additions & 3 deletions docs/WritePro/commands-legacy/wp-delete-style-sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ displayed_sidebar: docs
<!--REF #_command_.WP DELETE STYLE SHEET.Params-->
| Parameter | Type | | Description |
| --- | --- | --- | --- |
| styleSheetObj | Object | &#x1F852; | Style sheet object |
| wpDoc | Object | &#x1F852; | 4D Write Pro document |
| styleSheetName | String | &#x1F852; | Name of style sheet |
| styleSheetObj | Object | &rarr; | Style sheet object |
| wpDoc | Object | &rarr; | 4D Write Pro document |
| styleSheetName | String | &rarr; | Name of style sheet |

<!-- END REF-->

Expand Down
Loading

0 comments on commit 23da837

Please sign in to comment.