Skip to main content

Practice ยท 2 of 3

Role Gate (deny by default)

Write authorize(user, action, resource) โ€” a permission table maps role => allowed actions: admin: all; editor: ["read", "write"]; viewer: ["read"]. Unknown roles and unknown actions must be DENIED (default deny). Return "allow" or "deny".

Difficulty: intermediate

Back to lesson: Practice: Authorization Guards โ€” Practice