Permissions in a company app Write the permissions table before the first screen

Who sees prices? Who approves a discount? Who deletes an invoice? Settle those answers on paper first, then enforce them in the data itself.

Published Naqrah Tech, Muscat6 min read

A brass key hanging behind a frosted glass panel

In short

Permissions belong at the start of a company system, and they usually get written last. A short table says who sees what, who approves what and who can delete what. The rule in that table has to live in the database, because a hidden button only controls the requests that pass through that button.

  • A hidden button governs only the requests that travel through it.
  • Write the table with the owner, the accountant and the operations lead before a designer draws a screen.
  • An audit log answers "who changed this number?" without a long meeting.

A hidden button only hides the button

Picture a sales rep at an air-conditioning installer in Bousher opening the app on a Sunday morning. The screen shows the product list with no price-change button, so they assume prices are locked. The same screen displays the purchase cost, because the developer hid one button and left the field in place. Nobody broke in. Nobody decided where the block should sit.

The mistake is common because the interface gets drawn first and the rule gets written later, or never. The app becomes a list of buttons, and the number stays open to every request that reaches the server through some other path.

The OWASP Authorization Cheat Sheet asks for access checks on the server or in a trusted layer, and it asks for deny by default. It also says developers must never rely on client-side access control checks. A hidden button is a client-side check. It keeps the screen tidy and protects no data.

Write the table before the first screen

A permissions table is an administrative decision, and it has no technical features of its own. It needs three things: the role, the action and the answer. The owner, or a named delegate, signs it before any designer starts.

This is an illustrative table for an air-conditioning installer. It describes no real client:

RoleSees pricesApproves discountsDeletes invoicesSees edit history
Sales repOwn customers onlyBlockedBlockedBlocked
Sales managerAll pricesWithin a limitWith owner approvalAllowed
AccountantInvoices and paymentsBlockedWith owner approvalAllowed
Operations leadQuantities, no costBlockedBlockedOperations records only
OwnerEverythingAllowedAllowedAllowed

Look closely at "within a limit". It needs a number, and it needs a name: what is the limit, and who can go past it? Answer those two questions in the table and you save hours of argument inside the code later. The edit history column is the one teams forget, and they ask for it on the day of the first dispute over a price. The order of that move is set out in our guide, from spreadsheets and WhatsApp to a company app, and this table sits inside those steps.

The rule lives in the data

Once the table is final, it moves into the database. In Supabase, Row Level Security is switched on for every exposed table, and a policy for each role decides which rows that role can read and change. PostgreSQL documents that row policies are evaluated for each row before any conditions coming from the user's query. A row the policy excludes never reaches the screen.

Here is a detail that people who build these systems tend to know. Table owners bypass row security by default, unless the table is forced into it with FORCE ROW LEVEL SECURITY. In Supabase, the service_role key bypasses RLS completely, so it belongs on a server and nowhere else. Ask your developer where that key lives and who holds it today.

Run this test yourself. Ask the developer to show you the policy that stops a sales rep from reading the purchase cost of a product in another branch. If the answer is a button, the question is still open.

There is one more path people forget: export. An "Export to Excel" button looks harmless at the bottom of a screen, but it is a way to read all the data. The file it produces must follow the same permissions. A rep who sees only their own customers exports only their own customers. Write export as a separate line in the table, because it looks like a detail until a full file reaches the wrong hands.

The audit log settles the argument

Most arguments start with one question: who changed this number? A log written only by application code can be skipped by a path nobody considered, or lost in a careless update. So the log belongs in the database, written by a trigger on every change to a financial field. It records the old value, the new value, who made the change and when.

It looks like a detail until the first dispute. Suppose the sales manager says a price was 12.450 OMR, and the accountant sees 12.850. The log settles it in a minute. Without it, the dispute becomes a question of whom you trust. Decide who can read the log and write that into the table too. Usually that means the owner and an internal auditor, and no sales rep.

When an employee leaves

Access that takes one minute to grant should take one minute to withdraw. The quiet failures come from accounts that stayed active after their owner left. A common example: a rep moves to a competitor, and their login is never withdrawn. Another: a finance employee leaves, and the account still opens the payroll reports. The strangest is a shared login at the reception desk, whose password everyone in the company knows.

At this point the table answers three questions. Who withdraws the access, and on which day? What happens to sessions still open on phones? And what happens to the records that person created? The last answer surprises most teams. The records stay attributed to that person, because they are a work record, and the account alone is the way into them. Temporary access, such as an outside consultant's, carries an end date in the table.

When an employee moves from one branch to another, old permissions often stay in many systems, because the new ones were added on top and the old ones were never removed. After a few months a rep holds permissions for two branches, and it is hard for anyone to say which branch should stay. So review the table at every internal transfer, and replace the old role with the new one.

We apply the same rule to our own team. We withdraw our access when the work ends, or when you ask us to.

The data protection law asks for the same thing

Oman's Personal Data Protection Law was issued under Royal Decree 6/2022 and took effect a year after it was issued, and its transition period ended in February 2026. It gives the person whose data it is the right to access that data, correct it and ask for its erasure. It requires written consent before marketing messages, and a permit from the competent ministry before health or biometric data is processed. A controller must notify the ministry and the affected people of a breach.

Permissions are how those obligations get carried out inside the company. Who can see a customer's phone number? Who corrects an address when the customer asks? Who deletes a record when a deletion request arrives? If the table leaves those questions open, a complaint will answer them for you. The legal reading belongs to a legal adviser, so take the finished table to one before launch. Our guide on the law lists the points to check.

Before your first meeting with the developer, review the table with the person who will sign it. Then send it over and ask them to show you, row by row, where each rule lives in the data. If they answer with screens and skip the policies, you have found the first question that needs a clearer answer, and that is a good place to begin a conversation about custom software for companies.

Sources

  1. Royal Decree 6/2022 issuing the Personal Data Protection Law (decree.om, Arabic)
  2. Clyde & Co: Data Protection Law issued in Oman
  3. OWASP Cheat Sheet Series: Authorization
  4. Supabase docs: Row Level Security
  5. PostgreSQL docs: Row Security Policies

This post is general planning information as of its publication date. The official text of the law governs any dispute, and your sector's requirements need a legal review.

Send us your permissions table

We read your roles, propose the rule for each one, and show you where it lives in the data before we draw a single screen.

Or call us on +968 7119 0707, Muscat, Sultanate of Oman