DOCS / FEATURES
Organizations, roles & invitations
An organization is a tenant. Its data is kept apart from other orgs' at the row level, each person in it holds the owner, admin or member role, and newcomers join by invitation, up to the plan's seat limit.
The code is in api/src/orgs/: tenant guards in mod.rs, use cases in
service.rs, invitations in invites.rs. The UI is in
web/src/features/orgs/ and web/src/features/invitations/.
Row-level tenancy
Every tenant-owned table carries an org_id column with a cascading
foreign key to orgs, and queries against it always filter on org_id.
Access is enforced in the API layer: handlers call a guard before touching
org data, naming the permission the action needs.
| Guard | Passes when | Otherwise |
|---|---|---|
orgs::require_permission(db, org_id, user_id, Permission::X) |
The user is a member and their role holds X; returns their Access (a built-in role's permissions or a custom role's) |
403 |
orgs::authorize(state, org_id, &OrgActor, Permission::X) |
As above for a user; an API key belonging to this org passes when X is among its scopes |
403 |
A non-member gets 403 even for a record id that exists. The generated
module test in Adding a feature
pins exactly that.
Roles and permissions
What each role may do is defined once, in api/src/domain/permission.rs.
Each Permission names the least privileged role that holds it, and the
roles nest: an owner holds everything an admin does, and an admin
everything a member does. Handlers never compare roles themselves. They
ask for a permission, so moving one to another role is a one-line change.
The superadmin panel's Roles tab renders the same table from
GET /api/admin/roles, so it always matches what the API enforces.
[ full guide ]
The rest of this guide comes with the repo.
- Organization endpoints
- Invitations
- Seats
- Audit