A Component for creating new user accounts
Along with the instructor, start creating the Component, and examine its Events and controls.
- In the MobSec Web Projects Control Panel, create a new UX Component from the template highlighted below:
(These are all of the SecurityFramework templates.)
- Save the Component with file name AddNewUser.
- Display the Component in Working Preview.
- In Working Preview, click Show/hide notes for this Dialog. The instructor will review these notes.
(For this course, our New Group will be Sales.)
- Click the Design tab.
- Click Server-side Events.
- Click the onDialogInitialize Event. In its script window:
- Locate the line that begins e.control.UserRoles.
- Change New Users to Sales.
(The Event will use the websecurity_groups table.)
- Save the Component.
- Click the dialogValidate Event. Examine these lines in the script window:
- The lines that begin dialogValidate handle messages for errors validating security.
- The line in green validates values from the controls against the security tables.
- Click the afterDialogValidate Event.
Locate this line in its script window:
This command will save values to the userparms table (once we modify some controls), and execute a Server-side action to save control values to the rest of the websecurity_ tables.
- In the left-hand pane, click Controls. Examine the controls in FRAME_1.
- The userparms table has fields to map to the FirstName and LastName Controls.
- The table has a field named inactive that needs a control:
- Above the closing tag of FRAME_1, add a Checkbox control.
- Enter the Name Inactive, and the Label Inactive user?
- Its Type is Logical, and make its Default value .f..
- Save the Component.
Observe as the instructor binds the Component’s controls to the developer- defined userparms security table.
- In the left-hand pane, click Data Binding.
- In the Data Binding window, click this link:
- The Bind UX Controls window appears. Click the Specify Tables button.
- The Select Tables window appears.
- Delete the RegisteredUsers table.
- At the bottom of the window, click the Select button, and choose the connection string secsys, as shown here:
- Click the Add Table button. Choose the userparms table.
- When you return to the Select Tables window, it should look like this:
The Primary key field(s) is filled in automatically.
Accept the other defaults; click OK.
- Take note of the Important Warning that appears, and click OK.
- Returning to the Bind UX Controls window, click OK or Cancel (either will suffice in this case).
- If a Delete Table Aliases window appears, delete the RegisteredUsers alias, and click OK.
- Then, click this link again:
(Doing so refreshes the table values internally.)
- In the Bind UX Controls window, click the button.
If you receive any errors indicating that a “Field Type” is not known, click OK through all errors, then click Cancel twice and then click “Refresh table information after editing table schema”.
- Bind the FirstName and LastName variables to the fields with the same names.
- Bind the Username control to UserName field.
- Bind the Inactive control to the Inactive field.
- Click OK twice to exit.
- Click Server-side Events again.
- Click the afterDialogValidate Event, click on the line of code that reads “ExecuteServerSideAction(…)”.
- Click the button, and choose Edit Action from the box that appears.
- The window appears. Click OK.
This recompiles the Action and saves references to the userparms table.
- Click OK and Save the Component.
- Display the Component in Working Preview, and try using it.
Now you perform the data binding, and complete the Component.