Users and login

Users and roles live on the OPC UA server. On a B&R controller, define them in the Automation Studio project under Access and Security. When the HMI connects, LuxConnect opens an OPC UA session as a user, and the server applies that user’s permissions to every read and write.

  • Sign in with username and password when you create the OpcuaMachine.
  • Switch users without reconnecting with machine.changeUser(username, password). Call changeUser() with no arguments to switch to the anonymous user.
  • Read the current user and roles with machine.getSessionInfo(). Use the roles to show or hide screens.

Because the server checks every request, hiding a button is only a convenience. A user without permission can’t write the variable even if they reach it another way.