Permissions

Permissions decide who can see and do what on your platform, and how much of it. They cover your collections, forms and pages, and they hold the usage your plans include, such as 5 guides on one plan and 20 on another.

Anything no permission mentions is invisible to everyone except admins. A new collection, form or page stays hidden until you give someone access to it. Admins always see and do everything.

If your platform has no sign-in set up, nobody can be told apart, so everything is open to everyone.

The Permissions Page

Open Permissions in the project menu. Each permission is a card, with a line saying who it's for and what it covers. Click Add to create one, give it a name, and its page opens.

A permission's page is built from sections. Who is always there. Add the others with Add a section:

Remove a section with its trash button. Save applies everything at once, and Discard throws your changes away.

Each collection, form and page shows who can use it, with a link to the permissions that mention it.

Who

Pick one audience:

Signed-in customers can be narrowed down. Everything you narrow by has to match:

When several permissions apply to the same customer, any one of them allowing something is enough.

Access

Each access line covers collections, forms or pages:

Add as many lines as you need with Add access.

Usage

Usage counts one of two things:

Then set how many. When the permission names plans, each plan gets its own number. Leave a number empty for no limit. 0 means none.

Counted per chooses whose number it is: each person, each account, or the whole platform together, for example 100 beta spots in total.

For records, Counting chooses between what the customer has right now, where deleting a record frees a slot, and everything they've ever created.

When several usages count the same collection, a record can only be created if every one of them has room.

Over Time

At the Limit

Warn them at shows the customer a warning once they've used that percentage of their allowance.

Top-ups are packs customers can buy to get more, such as 100 more calls for $5. They pay through Stripe Checkout. With a reset, a top-up lasts until the next one. Without a reset, it lasts.

When the Plan Changes

Changing plans keeps what the customer already has. Someone with 10 guides who moves to a plan allowing 5 keeps their 10 and can't create more until they're under 5.

What Customers See

The generated platform hides what a customer can't use: pages leave the menu, and buttons to create, edit or delete disappear. Anything refused is explained, such as reaching a limit. Signed-in customers see their usage on the home page, with any warning and the top-ups they can buy.

Reporting Usage From Your Own Code

For a usage that counts uses reported by your own code, your platform has these endpoints. The usage's id is shown on its permission page.

See the API reference for the details.

Permissions From the CLI

devour sync writes your permissions into the configuration file, and devour setup --config <file> applies them. Collections, forms, pages and plans are named, not identified:

"permissions": [
  {
    "name": "Guides",
    "who": { "plans": ["Starter", "Pro"] },
    "access": [
      { "collections": ["Tours", "Exhibits"], "actions": ["view", "create", "edit", "delete"], "records": "account" },
      { "pages": ["Guide builder"], "actions": ["view"] }
    ],
    "usage": {
      "counts": { "collections": ["Tours", "Exhibits"] },
      "max": { "Starter": 1, "Pro": 10 },
      "per": "account",
      "kind": "total"
    }
  },
  {
    "name": "Contact form",
    "who": { "audience": "anyone" },
    "access": [{ "forms": ["Contact"], "actions": ["submit"] }]
  }
]

A permission missing from the file is removed after setup asks, or right away with --yes. Every key is listed in the CLI reference.

Projects Made Before Permissions

Existing projects were moved over without changing what their customers can do:

Related Documentation