Define authorizations and user groups in the HMI user administration, protect every command object with an authorization, send the logged-in group to the PLC with GetGroupNumber on user change, and let the PLC combine it with a physical key switch for maintenance functions. Back up the panel, because runtime users, recipe records and logs are not in the TIA project.
- Protect objects with authorizations, never with user names.
- The PLC enforces critical rights too: HMI group AND key switch.
- An untested backup is not a backup – restore it to a spare panel.
Users, Groups and Authorizations
WinCC user administration has three layers. An authorization is a right (Operate, Recipe edit, Maintenance, User administration). A group collects authorizations. A user belongs to a group and has a password and a logoff time. Objects on screens are protected by an authorization, so adding a person never needs a screen change.
| Group (number) | Authorizations | Typical logoff time |
|---|---|---|
| Operator (1) | Operate, Recipe load | 5 min |
| Maintenance (2) | Operator rights + Maintenance (manual jog, alarm reset of tech faults) | 3 min |
| Administrator (3) | All, including Recipe edit, Counter reset, User administration | 2 min |
Lab Flow: From Key Switch to Tested Rights and Backup
Stage 1Key Switch Wiring and PLC Tag
| PLC tag | Address | Type | Device |
|---|---|---|---|
S40_KeyMaint | %I4.7 | Bool | Maintenance key switch, 1 = MAINT, key removable only in RUN |
Stage 2Input Mapping into DB_IO
// FC_InputMapping "DB_IO".S40_KeyMaint := "S40_KeyMaint";
Stage 3Logic: Access Control in the PLC
The panel disables buttons, but the PLC must refuse the command as well, because a second panel, SCADA or an engineering laptop can write the same bits. The same principle protects recipes in the recipe transfer logic and manual operation behind the interlocks.
// DB_User (DB60): GroupNo : Int; UserName : String[20]; Maint_Enable, Admin_Enable : Bool;
// UserChanges : DInt; GroupOld : Int;
// FC_AccessControl – called after FC_InputMapping
"DB_User".Maint_Enable := "DB_User".GroupNo >= 2 AND "DB_IO".S40_KeyMaint; // HMI right AND physical key
"DB_User".Admin_Enable := "DB_User".GroupNo >= 3;
IF "DB_User".GroupNo <> "DB_User".GroupOld THEN // simple audit counter
"DB_User".UserChanges := "DB_User".UserChanges + 1;
END_IF;
"DB_User".GroupOld := "DB_User".GroupNo;
// Example use in a manual-mode network: the PLC enforces the right, not only the panel
"DB_Manual".Jog_Allowed := "DB_User".Maint_Enable AND NOT "DB_Alarm".Any_Fault;
Stage 4HMI Users, Groups and Tags
- Open Security settings → Users and groups in the project tree (HMI user administration). Create the authorizations, the three groups and one user per group with a logoff time.
- In the runtime settings for user administration, set password rules and the number of failed logins before lock-out where your panel version supports them.
- Drag
DB_Userinto the HMI tag table:DB_User_GroupNo(Int) andDB_User_UserName(String). - Create a scheduled task with the event trigger User change, calling
GetGroupNumber→DB_User_GroupNoandGetUserName→DB_User_UserName. On logoff the group number becomes 0. - Assign authorizations to the objects that need them – this is the list used by the recipe screen and the shift report screen.
Stage 5Link Login, Rights and Status to the Graphics
| # | Object | Properties | Tag / event |
|---|---|---|---|
| ① | Output field current user | In the template, visible on every screen | DB_User_UserName |
| ② | Buttons LOGIN / LOGOFF | No authorization needed | Click: ShowLogonDialog / Logoff |
| ③ | Command buttons | Properties → Security: authorization Operate / Recipe load / Counter reset | Their normal events |
| ④ | Maintenance group | Visibility animation: visible when Maint_Enable = 1 | DB_User_Maint_Enable |
| ⑤ | User view | Authorization User administration; shows users, groups, logoff times | System object |
Button styles and lamps follow HMI buttons, lamps and auto/manual mode; the overall layout follows HMI screen design best practices.
Backup and Restore of the Panel
A panel holds more than the TIA project. Recipe data records, data logs and users changed in runtime exist only on the panel. Downloading the project to a spare panel restores screens and tags but none of those.
| Data | In the TIA project? | Restored by project download? | Restored by panel backup? |
|---|---|---|---|
| Screens, tags, alarms, scripts | Yes | Yes | Yes |
| Users configured in engineering | Yes | Yes (unless set to keep runtime users) | Yes |
| Users and passwords changed in runtime | No | No | Yes |
| Recipe data records | No | No | Yes |
| Data logs and alarm logs | No | No | Yes, if stored with the backup or copied separately |
- Create a backup from TIA Portal (Online → Backup of the HMI device), with ProSave, or from the panel's Control Panel to a USB stick or SD card.
- Label it with machine, date and panel firmware and keep two copies, one off the machine.
- Restore it to a spare panel once, during commissioning, so the procedure is proven before it is needed.
Stage 6Perform and Test: Animated Login, Rights and Backup
Log in as different users and watch which buttons become operable. The maintenance functions need both the HMI group and the physical key switch, because the PLC checks GroupNo from the panel against the mapped key-switch input. Leave the panel untouched to see the automatic logoff. Finally, replace the panel with and without a backup and see what survives. Use the passwords shown – this is a simulation only.
| Panel data | Content |
|---|
Hands-On Lab: User Rights with Key Switch and Panel Backup
Hands-on- TIA Portal with WinCC Comfort and a panel or PLCSIM + HMI simulation
- A key switch on the trainer kit or a simulated input
- A USB stick or SD card for the backup
- Estimated time: 75 minutes
Wire the key switch and map the PLC tag
Wire the maintenance key switch S40 to %I4.7 and declare S40_KeyMaint in the PLC tag table.
Map the key switch into DB_IO
Copy S40_KeyMaint into DB_IO in FC_InputMapping.
Create DB_User and FC_AccessControl
Add GroupNo, UserName, Maint_Enable, Admin_Enable and an audit counter, and combine the HMI group with the key switch in the PLC.
Configure users, groups and HMI tags
Create the authorizations, the Operator, Maintenance and Administrator groups and users with logoff times, and a scheduled task on user change that writes GetGroupNumber and GetUserName to the DB_User tags.
Link login, rights and status to the graphics
Add Login and Logoff buttons, the current-user field, a user view for administrators and authorizations on every command; tie maintenance objects to Maint_Enable.
Perform, back up and test the restore
Test every user against every button, the automatic logoff and the key switch, then back up the panel and restore it to a spare.
Every command is protected by an authorization, the PLC knows who is logged in and enforces maintenance rights with the key switch, the panel logs off by itself, and a spare panel restored from backup behaves exactly like the original.
Frequently asked questions
What is the difference between a user group and an authorization?
An authorization is a right such as Operate, Recipe edit or User administration. A user group collects authorizations, and each user belongs to a group. Buttons and fields are protected by an authorization, never by a user name.
How do I send the logged-in user to the PLC?
Use the system functions GetGroupNumber and GetUserName in a scheduled task triggered by a user change, writing into HMI tags connected to a PLC data block such as DB_User.
Why combine an HMI login with a key switch?
A password can be shared; a key is physically controlled. Requiring both for maintenance functions, and checking it in the PLC, stops anyone with a panel or a laptop from bypassing the rule.
Are recipe records and runtime users part of the TIA Portal project?
No. Recipe data records, data logs and users changed in runtime live on the panel. Only a panel backup preserves them; downloading the project to a spare panel does not.
How often should the panel be backed up?
After commissioning, after every change to recipes or users, and on a fixed schedule. A backup that has never been restored is untested, so practise the restore on a spare panel.
What logoff time should I use?
Short enough that an unattended panel does not stay at a high rights level – typically a few minutes for maintenance and administrator users – and configured per user in the user administration.