Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

Designing permissions

Signing someone in settles who they are. What they may then do is a separate design problem, and it starts with naming the actions a service can allow or refuse. This lesson follows a newsroom's photo library from one all-or-nothing switch to a catalog of permissions that the service checks on every request.

From one flag to many permissions

The Tidewell Gazette, a fictional newspaper, keeps its newsroom pictures in a shared photo library on the photo service. Photographers upload, editors approve publication, and the legal team places holds. Theo, the library administrator, needs to give each person enough access to do their work.

The first library had one choice: administrator or reader. Administrators could upload, approve, delete and manage other accounts. Readers could browse. That seemed convenient until Lena joined as a freelance photographer for the Riverside festival.

Lena needs to upload festival photos and correct captions. The administrator setting would also let her approve publication and delete other people's work. The reader setting would prevent her doing the job. Theo cannot solve that problem by choosing the more generous label.

A permission names an action the service can allow or refuse. Uploading and approving become separate decisions, so Theo can grant one without granting the other. The list of every permission a service knows is its permission catalog, and its practical value is that it gives people meaningful choices about access.

Lena's job needs exactly two actions: uploading photos and correcting captions. Approving publication, deleting photos and assigning access all stay out of her grant. Which photos she may touch is a separate question that no permission name can answer, and her grant will later be limited to the festival album.

Actions on resource types

The Gazette uses names such as photo.upload and album.share. Each names an action on a kind of resource: the part before the dot is the kind of thing, the part after it is what is done to it. A name tied to a screen, such as upload_page, is less useful: an application can upload through an API too, and one screen can offer several actions.

The Gazette's permission catalog, one row per kind of work
Work to doPermission
Browse photo detailsphoto.view
Download a full-resolution filephoto.download
Upload assignment photosphoto.upload
Correct captions and keywordsphoto.edit_caption
Change license terms and creditsphoto.edit_rights
Approve publicationphoto.approve
Delete a photophoto.delete
Place or lift a legal holdphoto.place_hold
Create an albumalbum.create
Share an albumalbum.share
Edit a role's permissionsrole.edit
Assign a role to a personrole.assign

Granularity means how much work one permission covers. A single photo.manage would still give Lena too much. A separate permission for every caption-formatting option would bury Theo in choices nobody makes separately. The useful question is whether the organization needs to grant the actions to different people.

The Gazette keeps captions and keywords together because the same people edit both. Rights information gets its own permission because fewer people should change a license agreement. Editing a role and assigning it are separate too: designing a bundle of access is a different responsibility from deciding who receives it.

A catalog only names decisions. Adding photo.download to it does not protect a single file until the code that serves the download asks whether the caller holds it.

Checking permissions, not titles

A role bundles permissions under one name, so Theo can give a group of people the same set at once. An editor role might contain viewing and approving. The service should ask, "May this person approve this photo?" rather than rely on a role's name. Theo can then change what a role includes without changing the name or rewriting every place that uses it.

Omar edits sports photos but only browses news photos. A title such as "editor" cannot describe both situations by itself. An access decision needs the authenticated person, the requested action and the actual resource, the same parts Deciding what someone can do named. The server loads the photo and checks its album; it does not trust a browser to nominate a different person or claim that any photo belongs to the festival.

Permissions also need an enforcement point, the place in the service where the decision is actually made. Hiding an Approve button makes the interface clearer for Lena, but a direct request must receive the same refusal. The check belongs where the service performs the action, using the person's current assignments and the relevant resource, so a page that was loaded before Theo changed her access cannot carry the old access forward.

For builders Compare a title check with an action check

This illustrative TypeScript assumes the request is authenticated and the service has loaded the photo. The access function must evaluate current grants and resource scope; its name alone supplies no protection.

// A title check embeds the role's meaning in this route.
if (user.role === 'editor') await approve(photo);

// An action check lets the role catalog change independently.
if (!can(user, 'photo.approve', photo)) return refused();
await approve(photo);

A delegated client has another boundary: the access granted to that application, which Grants, scopes, and consent explained. Passing the client check does not replace checking the person's access to this photo.

Denying by default

Default deny starts every decision with no access. A valid grant for this person, action and resource can produce a permit. When Lena asks to delete a festival photo, no such grant exists, so the answer stays no.

An unknown permission must also be refused. If a developer misspells photo.approve, treating the unknown name as unrestricted would silently open approval. Refusing the request makes the mistake visible without granting unintended access.

Correct a caption

Permission checked
photo.edit_caption
In the catalog
Yes
In Lena's grant
Yes

Allowed

Approve a photo

Permission checked
photo.approve
In the catalog
Yes
In Lena's grant
No

Refused

A misspelled check

Permission checked
photo.aprove
In the catalog
No
In Lena's grant
No

Refused

Default deny starts every decision with no access.

Three requests from Lena, each checked against her grant. Only the action her grant names is allowed; a missing permission and a misspelled one are both refused.

A service that cannot finish the decision must not perform the protected action. This is failing closed. A policy-store outage and an ordinary denial can both prevent access, but their diagnostic reasons should stay distinct so a support team knows which one needs repair.

For builders Keep an error from turning into permission
function can(user, permission, photo) {
  if (!knownPermissions.has(permission)) return false;
  try {
    return currentGrantAllows(user, permission, photo);
  } catch {
    recordDecisionFailure(user.id, permission, photo.id);
    return false;
  }
}

Production code also distinguishes unavailable decisions from business denials in safe diagnostics. Do not log a session cookie or token to explain a refusal.

With these checks in place, Lena can correct the caption on a festival photo and is refused when she tries to approve it.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

Editors receive photo deletion only through the editor role. Theo removes that permission, and the photo service checks current permissions for every request. What else must change before an editor is refused? 1 of 3

Choose one answer.

A developer writes can(user, 'photo.aprove', photo) in the approve route, misspelling the permission. The library denies by default. What happens? 2 of 3

Choose one answer.

Lena opened an album page while she briefly held an editor role, so it still shows an Approve button. Theo has since removed the role. She presses Approve. What should happen? 3 of 3

Choose one answer.

Try it in the Lab

Try a Capture the Flag challenge

Apply this lesson against an isolated, intentionally vulnerable application. Capture a flag, explain the mistake, then repair and retest it.

  1. The Hidden Admin Action Difficulty 1 of 5 · About 20 minutes · Browser application
  2. Another User's Photo Difficulty 2 of 5 · About 30 minutes · Browser application

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity