Your question is RBAC Role Access Control. Take a moment with it on the right.
Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).
Design an RBAC permissions class that grants and checks role access.
Implement a focused, reusable class that supports assigning roles to users, defining permissions for roles, and checking whether a user may perform an action on a resource. Explain the data structures, public API, validation rules, inheritance or role composition decisions, and how the design remains safe and testable. Address invalid users, unknown roles or permissions, duplicate grants, revocation, and concurrent access where relevant.