Hide the approve button by role and enforce the permission on the server
On the page, the has() helper from the React SDK checks for the loan-officer role, so only a loan officer sees the Approve button. The approve route sends the mortgage.application.approve permission and the application ID to Auth, which resolves the officer's roles and any grant on that application before it returns whether the officer is authorized.
Impact
If someone without the permission calls the approve route directly, the route handler returns 403. Because the route handler calls authorizeAction on every request, a change to a role in Auth takes effect on the next request.
Prompt for a coding agent: Show the Approve button only to loan officers, and check their permission again in the route.
Select a file to view its contents
