Think Build Implement Repeat
London, UK +44 7367 067226
WhatsApp FOLLOW f in X
  1. Home
  2. Blog
  3. Deciding Who Can Do What
PHP Development

Deciding Who Can Do What

Designing users, roles and permissions in PHP applications: why hiding a button is not security, roles before individual permissions, ownership and audit.

Updated 2 min readBy SpiderHunts Technologies

Free estimateNo obligation

Get a free estimate

Tell us what you need. A senior engineer reads every enquiry.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →

Quick answer — TL;DR

Roles for most cases, individual permissions where the business genuinely needs them, and every check enforced on the server. Hiding a button is not a permission.

Hiding is not securing

Removing a button from the interface stops the average user and stops nobody who looks. Every action must be checked on the server, regardless of what the interface shows.

The most common authorisation failure we find is an endpoint that assumes the user could not have reached it, because the button was hidden.

Roles first, permissions where needed

  1. Start with a small number of roles reflecting real jobs
  2. Attach permissions to roles rather than to individuals
  3. Add individual overrides only where the business genuinely needs them
  4. Keep the number of roles small enough that people understand them

Twenty roles with overlapping permissions is unmanageable. Five clear ones covers most businesses.

Record ownership too

Role-based permissions answer “can this user edit orders?” They do not answer “can this user edit this order?” Both questions need answering.

  • Filter every list query by what the user may see
  • Check ownership before allowing any single-record action
  • Never trust an identifier in the request to determine access
  • Test with two accounts trying to reach each other's records

Make it auditable

Who did what and when, for anything consequential. That is both a security control and the answer to most “how did this happen?” questions.

Include permission changes themselves in the audit trail — who granted whom what access is frequently the important question.

Keep it operationally simple

RequirementWhy
Someone non-technical can grant accessOtherwise it goes through a developer
Access can be removed instantlyLeavers
A list of who has whatPeriodic review
Sensible defaults for new usersLeast privilege by default
Temporary access with an expiryContractors and cover

FAQ

Frequently asked questions

The questions readers ask us after this guide.

Still have a question?

Ask us directly — a senior engineer will get back to you.

Ask about your project

How many roles should we have?

As few as reflect actual jobs — usually three to six. More than ten suggests the model needs rethinking.

Should we use the framework's system?

Yes, unless you have a genuine requirement it cannot meet. Hand-written authorisation is where mistakes happen.

How do we handle someone covering another role?

Temporary role assignment with an expiry date, audited. Sharing a login is the common alternative and it destroys the audit trail.

What about API access?

Same permission model, applied to tokens. An API that bypasses your permission system is a hole in it.

Keep reading

More on PHP Development

PHP Development

Why PHP Is Still a Sensible Choice

Is PHP still a good choice for business applications? Where modern, typed PHP fits, where another language is better, and the hosting and hiring arguments.

PHP Development

Improving Old Code Without a Rewrite

Modernising a legacy PHP application without a rewrite: move to a supported PHP version, add tests around what matters, then strangle rather than replace.

Start here

Everyone in your system an administrator?

That is the most common permission model and the least defensible. Worth fixing before it matters.

  1. You tell us what you needTwo minutes on the form, or a message on WhatsApp.
  2. A senior engineer reviews itAnd comes back with questions, a realistic range and an honest view on fit.
  3. Free 30-minute scoping callWe talk through scope, options and a realistic estimate — with no obligation.
Free estimateNo obligation

Talk to someone who builds this

Send a short brief and we will come back with an honest view and a realistic range.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →