Skip to main content

Module defaults

Module defaults 

Source
Expand description

Built-in resources.

organization, membership, user, api_key and oauth_connection exist in every app. Together they make apps multitenant out of the box: users join organisations through memberships (which also carry their role within that organisation), and every other resource is isolated per organisation by default.

Drop a models/<name>.toml with the same name to replace a built-in and add fields or tweak permissions while keeping the machinery working.

Constants§

API_KEY_TOML
Default api_key resource (global). A valid key authenticates as its owner.
MEMBERSHIP_ROLE_TOML
A single role held by a membership.
MEMBERSHIP_TOML
A user’s membership in an organisation, carrying their role there. The join table behind the N:N between user and organization.
OAUTH_TOML
Default oauth_connection resource (global) linking a user to a provider.
ORGANIZATION_TOML
The organization — the tenant. global because its rows are the organisations; membership (not an organization_id) decides who sees them.
USER_TOML
The default user: global (users are shared across organisations) with email + password auth. Extend via models/users.toml.

Functions§

builtins
The name → embedded-TOML table of built-ins, in dependency order so foreign keys resolve (organization and user before membership/api_key/oauth).
parse_builtin
Parse one built-in by its embedded TOML. Panics on a malformed built-in — that would be a bug in this crate, caught by the test below.