Creating a Display That Adds Security Users

This example builds a GraphWorX display where an operator enters a user name and a password and selects a button to create a Security user. The display hashes the password before the command sends it, and a message on the display says whether the command created the user.

The Configure Security command shows nothing in runtime when it fails, and it returns no values that a later command can read. To give feedback, the button runs a Batch command. Its first step runs Configure Security, and the next step depends on whether that step succeeded or failed. Each of those steps uses Set Value to put a message in a local simulation tag that the display shows. Local simulation tags belong to the client, so each operator sees only the result of their own click.

To create a display that adds Security users:

  1. In GraphWorX, select the display canvas or grid, and in the Properties panel, in Name, enter a name for the display, such as AddUserDisplay.

  2. Go to the Dynamics ribbon and add a Data Entry process point to the display. In the Data section of its Dynamics panel, set the DataSource to localsim::NewUserName:String.

  3. Add another data entry point for the password and set the following in its Dynamics panel:

    1. In DataSource, enter localsim::NewUserPassword:String.

    2. In the Dynamic Behavior section of the password data entry point's Dynamics panel, set these properties:

      Property

      Value

      Password

      True

      PasswordHashing

      Password-Based Key Derivation Function 2

  4. Add a process point for the message and set its DataSource to localsim::SecurityResult:String.

  5. Add a button for executing the command and set the following in its Dynamics panel:

    1. In the Dynamic Behavior section, select Command, expand the drop-down list, and select Batch in the Global Commands section.

    2. In CommandParameters, select Steps and click to open the configuration.

  6. In the Configure dialog, click and add three steps with the following names and confiturations.

    • Configure

      1. Set Command to Configure Security.

      2. Enter its parameters:

        Parameter

        Value

        Action

        CreateUser

        UserName

        {{localsim::NewUserName:String}}

        Group

        Optional: A group the new user should belong to

        Policy

        Blank, for the default account policy

        Password

        {{localsim::NewUserPassword:String}}

        IsPasswordHash

        True

      3. In Continue With, set On Success to Go to step 'Success' and On Fail to Go to step 'Failure'.

    • Success

      1. Set Command to Set Value.

      2. Enter its parameters:

        Parameter

        Value

        PointName

        localsim::SecurityResult:String

        ValueType

        String

        Value

        A success message, such as x="The user was created."

        Target

        The name of the display, such as AddUserDisplay.

      3. In Continue With, set both On Success and On Fail to Quit.

    • Failure

      1. Set the same parameters as for the Success step, with a failure message in Value, such as: x="The user was not created."

      2. In Continue With, set both On Success and On Fail to Quit.

  7. When finished, click OK to save and close the configuration, and then switch to the runtime mode.

  8. In runtime, enter a user name and a password and click the command button. The message shows whether the command created the user.