Intelligence is foundation
Podcast Subscribe
Web Development Thursday, 16 April 2026

Five database tables that solve permissions forever

Share: LinkedIn
Five database tables that solve permissions forever

A developer watched how businesses actually manage permissions - who can see what, who can change what, who can delete what - and realised the entire mess belongs in five database tables.

Not scattered through code logic. Not hardcoded in if statements. Not maintained in three different places depending on which developer wrote that module. Five tables. Done.

This is Role-Based Access Control, and if you haven't encountered it yet, you're about to have one of those "why didn't anyone tell me this existed?" moments.

The observation that changed everything

The developer noticed something: when business people talk about permissions, they naturally think in roles. "Marketing can view reports but not edit them. Admins can do everything. Contractors can only access their own projects."

But when developers build permissions, they tend to scatter the logic everywhere. User checks in the controller. Different checks in the service layer. Maybe some stuff in the database, maybe some stuff in the frontend. Every feature has its own permission system.

Then business requirements change. "Actually, we need a new role for external auditors who can see financial data but not operational data." And you're editing code in seventeen places, hoping you didn't miss anything.

The five-table model solves this by making permissions data, not code.

How it actually works

Five tables: Users, Roles, Permissions, User-Roles (junction table), Role-Permissions (junction table).

Users have roles. "Sarah is a Manager." Roles have permissions. "Managers can edit reports." When Sarah tries to edit a report, the system checks her roles, checks what those roles can do, and grants or denies access.

Change requirements? Add a new role or update role permissions. No code changes. No deployment. No "oops, we forgot to update the admin panel logic."

The developer who wrote about this discovered RBAC through necessity - a project where permission requirements kept shifting, and maintaining the logic in code was becoming unmaintainable. Five tables later, the business could manage their own permission structure without involving engineering.

Why this survives framework migrations

Here's the clever bit: because permissions are data, they're framework-agnostic. The developer migrated from one backend framework to another, and the permission system came along unchanged.

The tables stayed the same. The business logic - "what can this role do?" - stayed the same. Only the code that reads those tables changed, and that's a thin layer.

Compare that to permissions hardcoded in application logic. Every framework migration means rewriting every permission check. Every new feature means deciding where and how to implement access control. Every bug means hunting through the codebase to find where the check is failing.

With RBAC, permissions are infrastructure. They exist independently of your application code. That's why the pattern has survived decades - it separates concerns properly.

The auditability factor

When permissions live in database tables, you can query them. "Show me everyone who can delete financial records." "What permissions does Sarah have?" "When did we grant this role that capability?"

Try answering those questions when permissions are scattered through code. You're grepping the codebase, reading through controllers, hoping you found all the checks. And you definitely can't answer "when did this change?" unless you're digging through git history.

With RBAC, every permission is a row in a table. Want an audit trail? Add timestamps and a change log table. Want to temporarily revoke access? Update a row. Want to know who changed what? Database-level tracking does that automatically.

For any application handling sensitive data - healthcare, finance, anything compliance-heavy - this auditability is essential. Regulators don't accept "the permissions are in the code somewhere." They want logs, they want timestamps, they want clear access trails.

When not to use this

RBAC is overkill for simple apps. If you have three users and two permission levels, you don't need five tables. An admin boolean on the user model is fine.

It's also the wrong pattern if your permissions are highly contextual - "users can only edit their own posts" or "managers can see reports from their department only." That's attribute-based access control, a different model entirely.

RBAC shines when you have multiple roles, changing permission requirements, and the need to manage access without code changes. Small projects with static permissions don't need it. Growing applications with evolving access requirements do.

The lesson developers keep relearning

This pattern exists because people keep discovering it independently. A developer runs into unmaintainable permission logic, searches for solutions, finds RBAC, and has the "oh, this is obvious in hindsight" realisation.

The core insight is simple: if business people think about something in terms of data - roles, permissions, relationships - then it should probably be data. Not code pretending to be data.

Five tables. Users, Roles, Permissions, and two junction tables to connect them. Survives framework changes, makes permissions auditable, lets business manage access control without engineering involvement.

If you're currently maintaining permission logic scattered through your codebase, this is your sign to stop and build it properly.

More Featured Insights

Artificial Intelligence
Snap cuts 1,000 jobs as AI writes 65% of new code
Quantum Computing
Quantum-inspired algorithm simulates 268 million atoms in moments

Today's Sources

GeekWire
Snap cuts 1,000 jobs citing 65% AI code generation
arXiv cs.AI
Numerical Instability and Chaos in Large Language Models
arXiv cs.AI
Exploration and Exploitation Errors Measurable for LLM Agents
arXiv cs.AI
SciFi: Autonomous Agentic AI Workflow for Scientific Tasks
arXiv cs.LG
Adaptive Memory Crystallization for Continual AI Agent Learning
arXiv cs.LG
Sparse Goodness Transforms Forward-Forward Learning
Phys.org Quantum Physics
Quantum-inspired algorithm solves 268 million-site quasicrystal in moments
arXiv – Quantum Physics
Quantum-inspired classical simulation through randomized time evolution
arXiv – Quantum Physics
Fast measurement of neutral atoms with multi-atom gate
arXiv – Quantum Physics
Comment on Einstein-Podolsky-Rosen Paradox resolution
Dev.to
Five Tables Changed Everything: RBAC and Database-Driven Permissions
Dev.to
EKS Ingress Address Not Assigned: Kubernetes ALB Incident and Resolution
InfoQ
OpenTelemetry Declarative Configuration Reaches Stability
Dev.to
Filtering, sorting, and pagination with fluent query builder
Hacker News
IPv8 Proposal (IETF draft)

About the Curator

Richard Bland
Richard Bland
Founder, Marbl Codes

27+ years in software development, curating the tech news that matters.

Subscribe RSS Feed
View Full Digest Today's Intelligence
Free Daily Briefing

Start Every Morning Smarter

Luma curates the most important AI, quantum, and tech developments into a 5-minute morning briefing. Free, daily, no spam.

  • 8:00 AM Morning digest ready to listen
  • 1:00 PM Afternoon edition catches what you missed
  • 8:00 PM Daily roundup lands in your inbox

We respect your inbox. Unsubscribe anytime. Privacy Policy

© 2026 MEM Digital Ltd t/a Marbl Codes
About Sources Podcast Audio Privacy Cookies Terms Thou Art That
RSS Feed