To allow access to the web server for a user, the corresponding function rights need to be assigned to the user in the hardware declaration file.
An example example.hwl.yaml file could look like this:
Devices:
- Name: Device1
Modules:
- Name: PLC_1
TypeIdentifier:
OrderNumber: 6ES7 516-3AN01-0AB0
Version: V2.9
AccessProtection:
AccessLevel: FullAccess
Services:
- Type: WebServer
Enabled: true
Parameters:
HttpsOnly: true
UserManagement:
Roles:
- Name: WebServerAccessRole
FunctionRights:
- ReadPlcVariables
- WritePlcVariables
Users:
- Name: user1
AssignedRoles:
- WebServerAccessRole
For the definition of users and function rights, see the UserManagement property. The function rights that can be assigned for the web server can be found in Web Server Function Rights.
In the example above, a single user named user1 is defined and assigned the WebServerAccessRole role.
The role has the function rights ReadPlcVariables and WritePlcVariables. This means that the user can both read and write PLC variables via the PLC's web server.