Permissions Manager
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L5
Problem
Given a list of permission operations, process them in order and return the list of boolean results from each 'check' operation. The operations have varying arity, so dispatch on the first element. Operations: ['grant', user, permission] (add the permission to the user), ['revoke', user, permission] (remove it, idempotently), ['check', user, permission] (append True/False for whether the user currently has that permission), and the 2-element ['update_config', {user: [permissions]}] (replace ALL users' permissions wholesale with the provided mapping). A 'check' on a user with no permissions yields False.
Summary
Manage user permissions with config updates.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.