RBAC permission evaluator

Write codeMedium18 minSalesforce and Microsoft style

Your task

Implement an RBAC permission evaluator. A user holds a list of roles; role_permissions maps each role name to a list of permission strings it grants. Given the user's roles, the role-permission map, and a required permission, return True if ANY of the user's roles grants the required permission. Unknown roles (not present in the map) grant nothing. A user with no roles is granted nothing.

Examples

has_permission(roles: list[str], role_permissions: dict, required: str) -> bool
Example 1
Inputhas_permission(["admin"], {"admin": ["read", "write", "delete"], "editor": ["read", "write"], "viewer": ["read"]}, "delete")
OutputTrue