Who a run acts as
Every entry in an app’s log records its caller, and every run sees that caller through the host. Because the node runs the call itself, for a caller it authenticated, there is no separate question of who signed a write: the log says who asked, and the leader that ran it is the cluster.
Caller kinds
Section titled “Caller kinds”The API builds the caller from the request’s credential; a client cannot name
one. An app reads it with env::caller() (crates/sdk/src/env.rs):
Caller |
When |
|---|---|
Account(id) |
A passkey session. |
ApiKey { key_id, account } |
An API key acting for account. |
Public |
No credential, on a public app, for a #[app::public] method. |
System |
The node itself: a timer tick (#[app::every]). |
App(id) |
A message or synchronous call from app id (Cross-app calls). |
A person has one identity everywhere: an account is the same on every device, so two of one person’s devices are the same caller.
The org the app sees
Section titled “The org the app sees”env::org() is the app’s organization, env::org_role(account) an account’s
role in it (Guest, Member, Admin, Owner), and env::in_team(account, team) its teams. The node answers from the system group’s state at the entry
the run applies on, so every replica agrees. With no organization, the owner
holds every role (Access control).
The node’s own runs
Section titled “The node’s own runs”Timers run as System and cross-app deliveries as App(source); neither has
an account, so guards::require_member() refuses them with LoginRequired. A
method that should run this way says so in its ABI: allow(system) (implied by
every) or allow(app = ..), and the node refuses every other caller kind for
it.