Skip to content
RED SAGSkills
mediumFull Stack Developer interview question

How would you add role-based access control (admin, editor, viewer) to an existing full-stack app?

What the interviewer wants to hear

  • Model roles and permissions in the database, scoped per organisation if needed
  • Enforce permissions on the server for every request and action
  • Centralize checks in one helper or policy layer
  • Use the UI only to hide or disable actions, never as the security boundary
  • Check ownership of specific records, not just the role
  • Test permissions and audit sensitive actions

Model answer

I start with the data model: users have memberships in an organisation, each with a role, and roles map to permissions such as project:edit or billing:manage. Checking permissions rather than role names makes it easier to add roles later. On the server I write one central helper, like can(user, "project:edit", project), and call it in every route handler and server action, because the server is the only real boundary. The check covers both the permission and the specific record, so an editor in one organisation cannot edit another organisation’s project by changing an ID. Database queries are also scoped by organisation ID. In the UI I use the same permission data to hide or disable buttons, purely for user experience. I add tests for each role on sensitive endpoints, follow least privilege for new roles, and keep an audit log of admin actions.

Can you answer it under time pressure?

Take a timed medium round and get scored on every answer.

Start mock interview

More medium Full Stack Developer questions