UserCreateByRole
- Last UpdatedFeb 02, 2024
- 2 minute read
This function is not available for a Windows user.
Creates a record for a new Plant SCADA user. The user can be assigned to a specified role (see Roles). The name of the user needs to be unique.
Note: Only users assigned an administrator role can create a user. Other users attempting to run this will encounter an error.
An alarm server needs to be configured and running in the project, so that all clients are notified that an online change to the users configuration has been completed.
In order to perform user configuration changes online in a system with multiple computers running SCADA nodes using these functions, you will need to use the RUN and COPY parameters to check the updates are distributed throughout the system, and that the functions are called from the computer which uses the COPY path as its RUN path.
This function is a blocking function. It blocks the calling Cicode task until the operation is complete.
Syntax
UserCreateByRole(sName, sFullName, sPassword, sRole)
sName:
The name of the user.
sFullName:
The full name of the user.
sPassword:
The password of the user.
The sPassword argument is optional. If not passed, this argument defaults to an empty string which is subsequently ignored. It is included for the purposes of handling duplicate user names and separate password identification compatibility.
sRole:
The role(s) to which the user will be assigned. If required, you can enter multiple roles as a comma separated list. The role(s) you specify need to be defined in Plant SCADA Studio's Security activity (see Roles).
Return Value
0 (zero) if successful, otherwise an error code is returned.
Related Functions
UserDelete, UserEditForm, UserPassword, UserPasswordForm, UserCreateForm
Example
/* Create a new user */
UserCreateByRole("Fred", "Fred Jones", "secret", "Operator");