ImportSecuritySystem
This function imports a security system configuration from an external file.
Function | Group | Execution | Windows | Embedded | Thin Client | Mobile Access |
---|---|---|---|---|---|---|
ImportSecuritySystem | Security | Synchronous | Supported | Supported | Not supported | Not supported |
Syntax
ImportSecuritySystem( strSecuritySystemPassword, strFileName, strFilePassword, optNumMode )
- strSecuritySystemPassword
- The main password for the project’s current security system configuration. (The security system must be enabled.)
- strFileName
- The complete file path and name of the configuration file that you want to import. (The file must have been previously exported from a IWS project using either the Security System configuration tool or the function ExportSecuritySystem.)
- strFilePassword
- The password for the specified configuration file.
- optNumMode
- A numeric flag indicating how the imported settings should be handled:
Value Description 0 Append the imported settings to the current settings. In the event of a conflict, replace with the imported settings. 1 Append the imported settings to the current settings. In the event of a conflict, keep the current settings. 2 Completely replace the current settings with the imported settings. This parameter is optional; if no value is specified, then the default value is 0.
Returned value
This function returns the following possible values:
Value | Description |
---|---|
-2 | Wrong parameter type. |
-1 | Invalid number of parameters. |
0 | Couldn’t read security data. |
1 | File imported successfully. |
Notes
This function can be called only from scripts executed on the project server. None of the connected clients — not even the client running on the same computer as the project server, because it runs as a separate process on that computer — have the necessary access to the security system. Therefore, generally speaking:
- It can be called from the Startup Script (which is executed when the project itself is run), Script Groups (which are continuously executed by the Background Task), and any Global Procedures called by them; and
- It cannot be called from the Graphics Script (which is executed separately by each client), Screen Scripts (which are attached to individual screens), and Command animations.
For more information, see VBScript Interfaces in the Software.
To work around this limitation, create a Script Group that actually calls the function, configure an appropriate tag/expression trigger in the Execution box of the Script worksheet, and then create a project screen that somehow changes the value of that tag/expression. Therefore, when a user on a connected client uses the screen to change the value, the Script Group will be executed on the project server.
Examples
ImportSecuritySystem( "curr3ntPa55w0rd", "C:security.txt", "1mp0rtPa55w0rd" )
ImportSecuritySystem( "curr3ntPa55w0rd", "C:security.txt", "1mp0rtPa55w0rd", 2 )