0
0
SCADA systemsdevops~30 mins

User authentication and authorization in SCADA systems - Mini Project: Build & Apply

Choose your learning style9 modes available
User authentication and authorization
📖 Scenario: You are working on a SCADA system that controls industrial equipment. To keep the system safe, only authorized users should access certain controls. You will create a simple user authentication and authorization setup.
🎯 Goal: Build a basic user authentication and authorization system that stores user credentials, sets a required access level, checks user credentials, and prints if access is granted or denied.
📋 What You'll Learn
Create a dictionary with exact usernames and passwords
Add a variable for the required access level
Write a function to check user credentials and access level
Print the access result message
💡 Why This Matters
🌍 Real World
SCADA systems control critical industrial processes. Securing access prevents unauthorized control that could cause damage or safety hazards.
💼 Career
Understanding authentication and authorization is essential for DevOps engineers managing secure infrastructure and access control.
Progress0 / 4 steps
1
Create user credentials dictionary
Create a dictionary called users with these exact entries: 'operator1': {'password': 'op123', 'access_level': 1}, 'engineer1': {'password': 'eng456', 'access_level': 2}, 'admin1': {'password': 'adm789', 'access_level': 3}.
SCADA systems
Need a hint?

Use a dictionary where each username maps to another dictionary with keys 'password' and 'access_level'.

2
Set required access level
Create a variable called required_access_level and set it to 2 to represent the minimum access level needed to control the system.
SCADA systems
Need a hint?

Just assign the number 2 to the variable required_access_level.

3
Write authentication and authorization function
Write a function called check_access that takes username and password as parameters. It should check if the username exists in users, the password matches, and the user's access level is greater than or equal to required_access_level. Return True if all checks pass, otherwise False.
SCADA systems
Need a hint?

Use an if statement to check username, then check password and access level inside.

4
Print access result
Call the function check_access with username = 'engineer1' and password = 'eng456'. Print 'Access granted' if the function returns True, otherwise print 'Access denied'.
SCADA systems
Need a hint?

Use an if statement to print the correct message based on the function result.