Role-based Access Control (RBAC) Basics
📖 Scenario: You are setting up a simple access control system for a small company. Different employees have different roles, and each role has specific permissions to access parts of the company's computer system.
🎯 Goal: Build a clear structure that shows which roles exist, what permissions each role has, and assign users to roles. This will help understand how RBAC works in real life.
📋 What You'll Learn
Create a dictionary called
roles with three roles: Admin, Editor, and Viewer.Each role should have a list of permissions exactly as:
Admin has ['read', 'write', 'delete'], Editor has ['read', 'write'], and Viewer has ['read'].Create a dictionary called
users with three users: 'Alice', 'Bob', and 'Charlie'.Alice should have the role 'Admin', Bob the role 'Editor', and Charlie the role 'Viewer'.Create a function called
get_user_permissions that takes a username and returns the list of permissions for that user's role.💡 Why This Matters
🌍 Real World
RBAC is used in companies to control who can see or change information, keeping systems safe and organized.
💼 Career
Understanding RBAC is important for cybersecurity roles, system administration, and software development to manage user access securely.
Progress0 / 4 steps