Role-based permissions and RLS: each person sees only what is theirs
When several people use the same program, not all of them should see or change the same things. Role-based permissions say what each type of user can do; row level security says which specific records they can see.
1Two separate layers
Role-based permissions answer “what can they do?”. The accounts role can issue invoices; the warehouse role can prepare orders but not see purchase prices; the management role can see everything but delete nothing. Roles are defined by job, not by person, and when someone changes job, their role changes.
Row level security (RLS) answers “which data can they see?”. Two sales reps have the same role, but each sees only their own customers. In a portal, every customer has the “customer” role, but each sees only their own invoices and orders. The rule is applied row by row, on every query.
2Examples in a small company
- A distributor with five sales reps: each sees their own accounts, proposals and outstanding payments; the sales manager sees everyone’s.
- A customer portal: the customer logs in and downloads their invoices and delivery notes, never anyone else’s, even if they change a number in the browser address.
- A property management firm: each residents’ association chair sees the incidents in their building and not the rest.
- A workshop: the technician sees the work orders assigned to them; the office sees all of them.
3Why hiding it on screen is not enough
This is the most common mistake in hastily built applications: the screen does not show another rep’s customers, but the database will still hand them over if someone asks for them directly. Knowing or guessing how to make the request is enough to see what should be off limits.
That is why the rule has to live in the database, which is the last door. If the database only returns the rows that belong to whoever is asking, it does not matter how the question is asked. The screen hides things for convenience; the database actually protects them. Where personal data is involved, limiting access to those who need it is also part of what the GDPR asks for; how it applies in your case is for your adviser to assess.
4What to ask whoever builds your software
- Are the access rules in the database or only on the screens?
- Which roles will there be, and who can change a person’s role?
- If a portal customer changes a number in the address bar, what do they see?
- Is there a record of who viewed or changed sensitive data?
5Where we apply row-level rules

Certero
Tender intelligence for public works
In Certero the database tables carry row level security rules, so access is decided in the database itself and not only on the screens. Live at certero.es.
Live at certero.es. Accepted into NVIDIA Inception.

VendorCheck
Supplier screening against official sanctions lists
VendorCheck follows the same approach in its database from the start. It is in development: the screening works, but accounts are not yet connected, so the rules have not been tested with real users.
In development. Matching against the official lists works; accounts, billing and alerts are coded and not yet connected. The screens are shown with an invented demo workspace.
6Frequently asked questions
How many roles should my application have?
As few as possible. Three or four that match real jobs are usually enough. Lots of near-identical roles end up being assigned wrongly.
Can one person have two roles?
Yes, and in a small business it is common: someone who handles accounts and also sales. The system adds up what each role allows.
Does row level security slow the program down?
In normal small-business use you will not notice if the rules are well written. Fixing a data leak costs more than designing it properly from the start.
Can it be added to an existing program?
Yes, but every query has to be reviewed and tested with users of each role. It is simpler to plan it from day one.
Who sees what in your company today?
List the jobs and what each should see. With that, we will propose the roles and the rules.
Tell us your problem