...
...
Exercise: User Login and Access to the Object
In this example, you will add a user to the project and assign security permissionsexercise, we will have two usernames called “A” and “B,” but username “B” will not be assigned any permission to compare the behavior between a user with and without permission. Then, you will configure the accessibility of the control functions in the Xpanel project.
Add a User
In this section, we will have two usernames called “A” and “B”, but username “B” will not be assigned to any group or permission.
Click Tools > Identity and Access Management… to bring up the Identity and Access Management pop-up window > click the + icon to add a new user.
...
...
Set the Username to “A” > click Edit User Password > set the password to “1234” > click OK > then click OK again when finished.
...
...
Username “A” will now appear on the user list.
...
...
Table of Contents | ||||||
---|---|---|---|---|---|---|
|
Create a User
Add the first user with username “A” and set the password to “1234”. Then, add the second user with username “B” and set the password to “1234” . You may follow the instruction above for guidance.
Add a Permission
On as well. Usernames “A” and “B” should now appear on the user list.
Create a Permission
Add a new permission named “Demo Permission” and add a description as necessary.
Create a Group
Add a group named “Test Group,” then assign user “A” and “Demo Permission” to the group. When finished, exit the Identity and Access Management pop-up window, click the Permissions tab > click the + icon > enter Permission Name and Description > click OK when finished.
New permission will now appear on the permission list.
...
On Identity and Access Management pop-up window, click the Group tab > click the + icon.
Set the Group Name to “Test Group” > click Edit under the Users section > select user “A” by checking the box > click OK.
Click Edit under the Permissions > select “Demo Permission” by checking the box > click OK.
User “A” and “Demo Permission” will now appear. Add a description as necessary > click OK when finished.
New group will now appear on the group list.
.
Create a Tag
Create a digital tag named “ON_OFF” with “BOOL” for Type.
Create an Object with Property Changes
Insert a Switch/Lamp object and click on the object to open the Property Editor pane. Then, assign the “ON_OFF” tag to Value under Lamp Properties.
While in the Property Editor pane for the Switch/Lamp object, in the Actions section, create new action command for the On Press called “ON_OFF Switch” with the action “Toggle Tag Value” and the digital tag “ON_OFF” assigned.
Once the “ON_OFF Switch” action command is created successfully, assign the created action command to the On Press action under the Action section.
In the Permission section, assign “Demo Permission” to the Permissions section under the Property Editor pane. This will allow only a user who has “Demo Permission” assigned to them.
Insert a text object and update “New Text” to “Login.”
Click the “Login” text object to open the Property Editor pane. In the Actions section, create new action command for the On Press called “Click to Login” with the action “Open Login Window” assigned.
Once the “Click to Login” action command is created successfully, assign the created action command to the On Press action under the Action section.
Insert a second text object and update “New Text” to “Logout”.
Click the “Logout” text object to open the Property Editor pane. In the Actions section, create a new script for the On Press called “Click to Logout” with
system.logout()
function in the script.
Once the “Click to Logout” script is created successfully, assign the created script to the On Press action under the Action section.
Checking the Operation
Run the project using a simulator environment and try logging in as user “A.” Then, try toggling the Switch/Lamp object ON/OFF.
Next, log out of user “A” and log back in as user “B.” Then, try toggling the Switch/Lamp object ON/OFF.
...
User “A” should be the only user to be able to toggle the Switch/Lamp ON/OFF since user “A” is the only user with permission to toggle the Switch/Lamp.