4D v14.3Configuring the 4D Database |
||
|
4D v14.3
Configuring the 4D Database
Configuring the 4D Database
For security and performance reasons, access to the tables, data and methods of the 4D database by means of 4D Mobile (Wakanda server) requests must be enabled and explicitly authorized. You must configure three levels of access:
By default, 4D Server does not respond to 4D Mobile requests. You must enable 4D Mobile services in order for these requests to be processed and so that the Wakanda / 4D connector can be used. Note: 4D Mobile services use the 4D HTTP server, so you need to make sure that the 4D Web server or 4D Server is started. To activate 4D Mobile services:
Control of 4D Mobile accesses lets you authorize (or not) the opening of a session on the 4D side following a Wakanda request. As part of a 4D Mobile access, the identifiers checked are the name and password sent during the connection request performed by:
At the global level, there are two ways to control 4D Mobile accesses:
These two control modes are exclusive: if an On 4D Mobile Authentication database method is defined, the control of automatic accesses by 4D passwords is disabled. Warning: if neither of these two control modes are enabled, accesses to the database through 4D Mobile are always accepted (not recommended). In 4D, you can specify the group of 4D users that is authorized to establish the link to the 4D server from the Wakanda application. To designate the logon account:
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 Wakanda request -- to open a session on the 4D Server using the mergeOustideCatalog() method, for example. If an account is used that does not belong to this group, 4D returns an authentication error to the sender of the request. Note that in order for this setting to take effect:
You can use the On 4D Mobile Authentication database method to control access rights for 4D Mobile requests sent to the Web server engine. When it is defined, it is automatically called by 4D or 4D Server when the HTTP server receives a 4D Mobile request. When the request to open a 4D Mobile session comes from Wakanda Server (general case), the connection identifiers are provided in the header of the request. The On 4D Mobile Authentication database method is called so that you can evaluate these identifiers. You can use the list of users for the 4D database or you can use your own table of identifiers. For more information, please refer to the On 4D Mobile Authentication database method description in the 4D Language Reference. Once 4D Mobile services are enabled in the 4D database, by default a 4D Mobile session can access all tables and fields of the database, and thus use their data. For example, if your database contains an [Employee] table, it is possible to write, on the Wakanda Server side: var emp=ds.Employee.query("name == 'Martin'"); //Return all employees whose name field is ’Martin’ Note: 4D tables and/or fields that have the "Invisible" attribute are also exposed in 4D Mobile by default. The Wakanda server can also access the project methods of the 4D database. However, by default, this access is disabled for security reasons. If you want to customize the list of database objects accessible in 4D Mobile, you must:
When a 4D Mobile request attempts to access an unauthorized resource (table or project method), 4D returns an error. By default, all tables are exposed in 4D Mobile. For security reasons, you may want to only expose certain tables of your database to 4D Mobile calls. For instance, if you created a [Users] table storing user names and passwords, it would be better not to expose it. To modify the 4D Mobile exposure for a table:
By default, all 4D database fields are exposed in 4D Mobile. You may not want to expose certain fields of your tables to 4D Mobile. For example, you may not want to expose the [Employees]Salary field. To modify the 4D Mobile exposure for a field:
Note that in order for a field to be accessible through 4D Mobile, the parent table must be as well. If the parent table is not exposed, none of its fields will be, regardless of their status. Because of this, you can temporarily enable/disable 4D Mobile exposure for a table, while the individual values of the Expose with 4D Mobile Service option for each field remain unchanged. No project methods are exposed in 4D Mobile by default. You may want to make certain project methods of your 4D database accessible by means of 4D Mobile. To do this, you must check the appropriate option and define the Wakanda execution context of the method. Note: If an access group is associated with the 4D method, you need to make sure that the 4D Mobile group is part of this group. To set 4D Mobile exposure for a project method:
When you declare a project method available through 4D Mobile requests, you must explicitly declare its calling context using the Table and Scope parameters:
Warning: When you change the exposure or scope of a project method on the 4D side, you have to reload the remote model on the Wakanda side for these changes to be taken into account. When 4D Mobile services are enabled, the tables exposed in 4D Mobile and the project methods attached to them are displayed on the "Methods" page of the 4D Explorer in the 4D Mobile Methods section: |
PROPERTIES
Product: 4D SEE ALSO
Configuring the Wakanda Application ARTICLE USAGE
4D Mobile ( 4D v14 R3) Inherited from : Configuring the 4D Database ( 4D v14 R2) |