In this activity, you will refactor a broken Access Control system to use Permissions instead of hardcoded Roles.
if "ADMIN" in role). A security audit revealed that the new role "ADMIN_VIEWER" (read-only) can accidentally delete users because of this partial string match.
We have a ROLE_PERMISSIONS dictionary mapping roles to their capabilities.
permissions list."delete_users" exists in that list."AUTHORIZED" or "DENIED".Hardcoding roles scales poorly. By checking Capabilities (what a user can do) rather than Roles (who a user is), you prevent privilege escalation when new, complex roles are added.