Skip to content

Organizations, teams & access

Access has two layers. The node decides who reaches an app at all, from the app’s access rule and the system state, on every request. Everything finer — who may edit which record — is the app’s own code, which can read the caller’s standing with env::caller_org().

Every rule on this page is enforced by the system group’s state machine when the command applies (The system group); the API checks most of them first so a refused request records nothing.

An app instance carries one Access rule (types::Access), set at creation and changed by its owner (POST /apps/{app}/access):

Rule Who reaches the app
owner (default outside an organization) The owner only
accounts { accounts } The owner and these accounts
org (default inside an organization) Every member of the app’s organization, any role
team { team } The team’s members (direct rows, and inheritance into an open team)
public Anyone, signed in or not (as Caller::Public when not)

The owner always reaches their app. A caller who does not reach it gets 404, so its existence is not disclosed; with no credential, 401. The check reads fresh system state, so removing someone from an organization or team holds on every node before their next request (Reads of the system state).

A member whose direct row in the app’s team is read-only still reaches the app and its calls run, but a call that would write anything is refused with 403. A blob upload by them is refused before it starts.

POST /orgs { name } creates an organization with its creator as owner. Members have one role each, ordered guest < member < admin < owner:

Role May
guest Reach the organization’s org-access apps
member Also own apps in the organization and create top-level teams if they hold CREATE_TEAM
admin Manage members and their roles (below owner), capabilities, teams, organization metadata; delete the organization’s apps; approve releases, upgrade apps and approve outbound hosts (they hold every capability)
owner Everything, plus ownership and deleting the organization. Release approvals are also open to APPROVE_RELEASES holders, upgrades and outbound approvals to MANAGE_APPLICATION holders (see Capabilities)

There is exactly one owner. SetOrgRole { role: owner } by the owner moves ownership and makes the previous owner an admin; the owner cannot be removed, only replaced. Leaving is removing oneself. Removing a member clears their capabilities, metadata and every team row they had. DELETE /orgs/{org} (owner, with a passkey step-up) deletes the organization with its teams, invites and apps.

An organization also keeps metadata for its apps and frontends to read (admins, or members holding MANAGE_METADATA), per-member metadata (the member or an admin), the mero-tee releases its APPROVE_RELEASES holders approved, the outbound prefixes its MANAGE_APPLICATION holders approved, and its recent upgrade runs. An organization may also be a publisher: a package signing key is bound to it by the key’s own signature (APPROVE_RELEASES holders send the binding), and it then approves releases, and (where the package says so) runs upgrades, for every instance of that key’s packages (Publishers). Each metadata value is at most 16 KiB of JSON. Any member reads, with GET /orgs/{org}/apps, the apps they reach or manage there with the release each runs and its last upgrade (who, of which kind), the releases that govern each app, and the releases the cluster’s nodes run (Reading the approvals).

Teams (types::Team; meroctl’s groups) nest (parent), move (UpdateTeam { parent }, never under themselves), and are one of two kinds:

  • Open (join: everyone): whoever reaches the parent team — at the top, the organization — is a member too, unless they were denied JOIN_OPEN_TEAMS there. Membership flows down an unbroken chain of open teams.
  • Restricted (join: invite): only direct rows. A restricted team is a wall: nothing flows through it.

A direct row has a role (lead, member or read-only) and capabilities. A team’s creator leads it. Whoever leads a team, or an ancestor team, or is an organization admin, manages it: renames it, adds and removes members, creates teams under it, moves it within what they manage, and deletes it.

  • A member who leaves a team, or whom a manager removes, does not come back by inheritance (Team::removed), so leaving an open team sticks. They return only when a manager adds them again or they redeem an invite that names the team; they cannot rejoin by themselves.
  • A member may join an open team they already reach as a plain member row, or leave any team themselves.
  • Deleting a team deletes the teams below it and the apps deployed to them.
  • Reads are filtered: a team someone neither reaches nor manages is left out of GET /orgs/{org} and answers 404 on its own route.
  • A team keeps metadata the app defines (a folder’s name and colour), set by those holding MANAGE_METADATA for it.

An app deployed with access: team must be created by someone who writes that team (a member whose row is not read-only).

Beyond their role, a member holds capability bits (types::caps, the MemberCapabilities values): organization-wide, with a default the organization sets, and per direct team row (a new row takes the member’s organization value). Admins and team leads hold them all where they manage.

Bit Name Checked by the node
1 << 0 CREATE_APP Creating an app in the organization (on its team, or org-wide)
1 << 1 INVITE_MEMBERS Minting an invite (org-wide, or on each team it names)
1 << 2 JOIN_OPEN_TEAMS Inheritance into open teams (granted by default)
1 << 3 MANAGE_MEMBERS Adding non-lead rows and setting capabilities in a team
1 << 4 MANAGE_APPLICATION Upgrading the organization’s apps (on the app’s team, or org-wide), organization-wide upgrade runs, and approving the organization’s outbound hosts (org-wide only)
1 << 5 CREATE_TEAM Creating a top-level team (or moving one to the top) without being an admin
1 << 6 DELETE_TEAM Deleting a team one does not manage
1 << 7 MANAGE_VISIBILITY Switching a team between open and restricted
1 << 8 MANAGE_METADATA Organization and team metadata
1 << 10 APPROVE_RELEASES Approving (or withdrawing) the mero-tee releases that hold the apps the organization governs: those of the packages it publishes, and its own apps of packages whose key is not bound; and binding a package signing key to the organization (org-wide only: a team grant does not reach it) (Release approvals)

Bit 9 is unused: v1’s MemberCapabilities spends it on CAN_AUTHOR_ON_BEHALF, so a client that sends v1’s ALL grants nothing new by accident. A grant is POST /orgs/{org}/capabilities { account, capabilities } by an admin, with their passkey (as every membership change: roles, removals and leaving, team rows; 412 CONFIRM_REQUIRED first); GET /orgs/{org} lists who may approve releases (releaseApprovers).

POST /orgs/{org}/invites { role, teams?, ttlSecs?, uses? } returns a token inv_…, after the inviter approves it with a passkey (412 CONFIRM_REQUIRED first; the consent binds { inviteKey, role, teams, expiresAt, uses }). Only the token’s Ed25519 public key is stored (inviteKey, the key whose seed is SHA-256("calimero.invite.v1\0" ‖ token)). An invite expires (7 days by default) and admits uses accounts (1 by default). Its role may not exceed the inviter’s and is never owner. An inviter below admin may name only teams they manage. POST /invites/{token}/redeem, by a signed-in person (no passkey prompt): the node signs the redemption with the token’s key, which every node checks where it applies, so a node that saw only the log cannot redeem an invite. It adds them at the invite’s role (or keeps a higher role they already have) and gives them a plain row in each named team. Only a redemption that does one of those spends a use: an account already in the organization at the invite’s role or above, and in every team it names (an owner opening their own link, say), gets the organization back and leaves the use for the person the invite was made for. The last use removes the invite; redeeming it after that, or after its organization is deleted, is refused 400 REJECTED (“this invite was used up, revoked or never existed”), and past its expiry “this invite has expired”. A redemption an earlier release logged replays as that release applied it (it spent a use whatever it changed): the API marks new ones (RedeemInvite { free_when_unchanged: true }).

An organization may hold a recovery key (Org::recovery): an Ed25519 key whose 32-byte seed its owner keeps offline; the organization stores only the public half (publicKey, base64url). It is set at creation (POST /orgs { name, recoveryKey }) or by the owner later, with a passkey (POST /orgs/{org}/recovery { publicKey }, consent org:<org> / __set_recovery_key / { publicKey }; null removes it). An organization created before recovery keys has none until its owner sets one.

Whoever holds the seed hands the organization to the account they are signed in as: the client signs "calimero.org-recovery.v1\0" ‖ org ‖ 0 ‖ account ‖ 0 ‖ nonce with the seed and sends only the signature (POST /orgs/{org}/recovery/start { nonce, signature }). Every node checks it against the organization’s current key where StartRecovery applies and spends it, so a node that saw the log cannot redirect or replay it. The recovery then waits RECOVERY_DELAY_SECS (72 hours, judged at the commands’ own times); members see it as recovery.pending on GET /orgs/{org}. The owner may cancel it with a passkey (__cancel_recovery { account }), and setting a new key cancels it too. Once the delay has passed, the account it names finishes it with its own passkey (__finish_recovery { org }): it becomes the owner, every previous owner leaves the organization and its teams, and the apps they owned in it become the new owner’s. One recovery runs at a time (409 RECOVERY_PENDING). Recovery never changes an account’s passkeys: the previous owner’s account and its other organizations are as they were.