Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

  1. Add

...

In this section, we will have two usernames called “A” and “B”, but username “B” will not be assigned to any group or permission.

  1. Click Tools > Identity and Access Management… to bring up 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” as well. Usernames “A” and “B” should now appear on the user list.

    Image Added

  2. Add a new permission named “Demo Permission” and add a description as necessary.

    Image Added

  3. 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 + icon to add a new user.

    Image Removed

  4. Set the Username to “A” > click Edit User Password > set the password to “1234” > click OK > then click OK again when finished.

    Image Removed

  5. Username “A” will now appear on the user list.

    Image Removed

  6. Now, please add the second user with username “B” and set the password to “1234”. You may follow the instruction above for guidance.

Add a Permission

  1. On Identity and Access Management pop-up window, click the Permissions tab > click the + icon > enter Permission Name and Description > click OK when finished.

    Image Removed

  2. New permission will now appear on the permission list.

    Image Removed

...

  1. On Identity and Access Management pop-up window, click the Group tab > click the + icon.

    Image Removed

  2. Set the Group Name to “Test Group” > click Edit under the Users section > select user “A” by checking the box > click OK.

    Image Removed

  3. Click Edit under the Permissions > select “Demo Permission” by checking the box > click OK.

    Image Removed

  4. User “A” and “Demo Permission” will now appear. Add a description as necessary > click OK when finished.

    Image Removed

  5. New group will now appear on the group list.

    Image Removed

    .

    Image Added

  6. Create a digital tag named “ON_OFF” with “BOOL” for Type.

    Image Added

  7. 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.

    Image Added

  8. 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.

    Image Added

  9. Once the “ON_OFF Switch” action command is created successfully, assign the created action command to the On Press action under the Action section.

    Image Added


  10. 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.

    Image Added

  11. Insert a text object and update “New Text” to “Login”.

    Image Added

  12. 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.

    Image Added

    Once the “Click to Login” action command is created successfully, assign the created action command to the On Press action under the Action section.

    Image Added

  13. Insert a second text object and update “New Text” to “Logout”.

    Image Added

  14. 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.

    Image Added


    Once the “Click to Logout” script is created successfully, assign the created script to the On Press action under the Action section.

    Image Added

  15. Run the project using a simulator environment and try logging in as user “A.” Then, try toggling the Switch/Lamp object ON/OFF.

  16. Next, log out of user “A” and log back in as user “B.” Then, try toggling the Switch/Lamp object ON/OFF.

Please note that 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.

...