0
0
Operating Systemsknowledge~30 mins

Access control matrix in Operating Systems - Mini Project: Build & Apply

Choose your learning style9 modes available
Access Control Matrix
📖 Scenario: You are managing a simple computer system where different users have different permissions on various files. To keep track of who can do what, you will create an access control matrix.This matrix shows which users have which permissions (like read, write, execute) on each file.
🎯 Goal: Build an access control matrix using a dictionary of dictionaries. Each key in the main dictionary is a user, and its value is another dictionary showing files and the permissions that user has on those files.
📋 What You'll Learn
Create a dictionary called access_matrix with exact users and files
Add a list of permissions for each file per user
Use a helper variable to list all possible permissions
Write a loop to check and list permissions for a specific user
Add a final step to show the permissions of a chosen user on all files
💡 Why This Matters
🌍 Real World
Access control matrices are used in computer systems to manage who can access or modify files and resources, ensuring security and proper authorization.
💼 Career
Understanding access control is essential for roles in system administration, cybersecurity, and software development to protect data and resources.
Progress0 / 4 steps
1
Create the access control matrix
Create a dictionary called access_matrix with these exact entries: 'Alice', 'Bob', and 'Charlie' as keys. Each user should have a nested dictionary with files 'file1' and 'file2'. Set the permissions as lists exactly like this: 'Alice': {'file1': ['read', 'write'], 'file2': ['read']}, 'Bob': {'file1': ['read'], 'file2': ['read', 'execute']}, 'Charlie': {'file1': [], 'file2': ['write']}.
Operating Systems
Need a hint?

Use nested dictionaries where each user maps to another dictionary of files and their permission lists.

2
Define the list of all possible permissions
Create a list called all_permissions that contains these exact strings: 'read', 'write', and 'execute'.
Operating Systems
Need a hint?

Just list the three permission strings inside square brackets.

3
List permissions for a specific user
Write a for loop using variables file and permissions to iterate over access_matrix['Bob'].items(). Inside the loop, create a new dictionary called bob_permissions that stores each file as key and its permissions as value.
Operating Systems
Need a hint?

Use for file, permissions in access_matrix['Bob'].items(): to loop through Bob's files and permissions.

4
Show Bob's permissions on all files
Add a final line that assigns bob_permissions to a variable called result. This will represent the completed access control information for Bob.
Operating Systems
Need a hint?

Just assign bob_permissions to result to complete the project.