Skip to content

Quiz: Worked Example — RBAC API

Review first: Worked Example: RBAC API

#

Question 1

An expense API has three roles. POST /expenses/{id}/approve is guarded by hasAuthority('expense:approve'), granted to managers and admins. Which bugs remain? Select ALL that apply:

#

Question 2

The team is debating GET /expenses for everyone plus a separate GET /admin/expenses for admins. Why does the worked example prefer one endpoint?

#

Question 3

Expense 123 belongs to Bob. Alice (another employee) calls POST /expenses/123/approve and gets 404. Bob calls the same endpoint on his own expense and gets 403. Why the difference?

#

Question 4

GET /expenses and GET /expenses/{id} both go through visible_to(user). The new GET /expenses/export endpoint checks expense:export:team and then runs SELECT * FROM expenses. What happens when a manager calls it?

#

Question 5

PUT /users/{id}/roles is admin-only. Which additional hardening does the worked example recommend? Select ALL that apply: