User roles
The base framework of the PLC does not know any users, but only roles. Therefore, the further description deals with the meaning of the roles.
An application (e.g. TcHmiBa) defines users and then assigns them a corresponding role.
According to the role of a logged-in user, functions are made available in the application or not.
Roles
Different access rights are provided for different users:
Role | Description |
---|---|
Guest | Lowest access permissions. |
Basic | Restricted access permissions. |
Advanced | Extended access rights. |
Expert | Full access rights. |
Internal | For Beckhoff support only. |
![]() | The user's access area is evaluated at different points in the application to enable or hide certain functions. |
Adjustment of access rights from the PLC
It is possible to define access rights from the PLC.
However, this only works initially, i.e. not at runtime, and then refers to all objects that have this property.
To do this, an instance of FB_BA_Param is created in a suitable part of the program, preferably in MAIN, and pre-initialized with the corresponding write and read rights.
![]() | The initialization is sufficient - there is no further call in the actual program part. |
Sample:
In the following sample, the read and write rights are to be changed for two parameters:
- Acknowledge (bAcknowledgeRm): Read from Basic role, write from Expert role.
- DefaultValue (bDefaultValue, fDefaultValue, nDefaultValue): Read from Internal role, write from Advanced role.
This adjustment requires the instantiation of a FB_BA_Param, here called Parameters, which is structured as follows:
Parameters : FB_BA_Param := (DefReadAccess := F_BA_ParameterRolesBuilder()
.Set(E_BA_Parameter.eAcknowledgeRm, E_BA_Role.eBasic)
.Set(E_BA_Parameter.eDefaultValue, E_BA_Role.eInternal)
.Build(),
DefWriteAccess := F_BA_ParameterRolesBuilder()
.Set(E_BA_Parameter.eAcknowledgeRm, E_BA_Role.eExpert)
.Set(E_BA_Parameter.eDefaultValue, E_BA_Role.eAdvanced)
.Build());
The DefReadAccess and DefWriteAccess properties each represent an array of the various parameters with the associated roles as minimum access and are only used to change the roles, which are, however, already predefined.
The Set methods change the minimum access role (E_BA_Role) for a specific parameter (E_BA_Parameter). A Set method must be added for each parameter whose access right is to be changed.
The parameterization of the properties is completed by calling the Build method. This applies to both the DefReadAccess read access property and the DefWriteAccess write access property.
The above implementation changes the read and write access of all objects that have the properties bAcknowledgeRm and DefaultValue (bDefaultValue, fDefaultValue, nDefaultValue). It is also possible to change only the read or only the write access; the change does not have to be made in pairs.
Using the example of an AV object, the change in the Site Explorer is as follows:
