# Namespaces and access Status: built for phase 1: namespaces, organisations, members, teams, grants and their pages, the registry rules, service accounts. GitHub and Discord mapping is not. Last updated 2026-11-25. ## Namespaces Repositories live under GitHub-style owners: `owner/repo`. - **Two kinds of owner:** a user (personal namespace) or an organisation. - **One name table.** Usernames and organisation names share a single table, so they cannot collide. - **Every user has a personal namespace** named after their username. - **Organisations** have members and teams. - **Names are fixed in the first version.** Renaming a namespace would mean renaming the Lore repositories under it, and whether Lore allows that is unverified. ### How this maps to Lore Verified in Lore's source; see [lore-integration.md](lore-integration.md). - Lore repository names may contain `/`, so `studio/game` is a valid repository, addressed as `lore://host/studio/game`. - One `loreserver` hosts all namespaces. - Lore identifies a repository by ID. The name is a label; permissions and tokens use the ID. ### Enforcing namespaces through the registry `loreserver` asks lore-forge before it creates or deletes a repository, forwarding the caller's token. On **register** (create), lore-forge: 1. checks the name has the form `/` and that both parts are valid; 2. checks the owner exists (answers "not found" otherwise); 3. checks the caller may create repositories in that namespace (answers "permission denied" otherwise); 4. records the repository with the caller as its owner. On **unregister** (delete), lore-forge checks the caller holds the owner role on the repository. For **list**, lore-forge returns the repositories the caller has any grant on, with the actions held on each. So `lore repository create lore://host/studio/game` works from the CLI and is subject to the same rules as creating a repository in the web UI. ### Who may create what | Action | Allowed for | | --- | --- | | Create a repository in a personal namespace | That user | | Create a repository in an organisation | Members the organisation allows (owners by default) | | Create an organisation | The owner's `orgs.create` setting: instance admins (the default) or everyone. The creator becomes its owner. The default is not yet confirmed | ## Organisations and teams - **Members** belong to an organisation with an organisation role: owner or member. - **Teams** are named groups of members within one organisation. - **Base permission:** an organisation may give all its members a default role on all its repositories (for example Reader), or none. Owner cannot be a base permission. - An organisation always keeps at least one owner: the last one cannot be demoted or removed. - Only members can join a team; removing a member from the organisation removes them from its teams. Deleting a team deletes its grants. - Organisation owners manage members, teams, settings and service accounts at `/orgs//...`. Members see the organisation's members and teams. ## Role presets Permissions are presented as presets that map onto Lore's actions. | Preset | Lore actions | Meant for | | --- | --- | --- | | Reader | `read` | Clone and browse | | Writer | `write` | Push to unprotected branches, take locks | | Maintainer | `write`, `set-protected` | Also protect and unprotect branches | | Admin | `write`, `admin` | Also release others' locks, manage the repository | | Owner | `write`, `owner` | Also delete the repository | Verified in Lore's source at `6b12f00` (`lore-server/src/grpc/mod.rs`, `lore-server/src/grpc/lock_service.rs`, `lore-server/src/authnz/resource_grants_authorizer.rs`): - **Actions are checked literally; none implies another**, except that any grant implies `read`. So `owner` does not include `write`, which is why Owner lists both. - Every "administer the repository" check accepts `owner` **or** `admin`: releasing others' locks, protecting branches (which `set-protected` also allows), and deleting the repository. - Pushes and branch changes need `write`; a push to a protected branch also needs `push-protected`. - Lore itself would let an Admin delete a repository. lore-forge's registry refuses the unregister unless the caller has Owner, so in practice only Owner deletes. ### Advanced view Four actions are not part of any human preset and are granted individually: | Action | What it allows | Why it is separate | | --- | --- | --- | | `push-protected` | Push to a protected branch | Holding it bypasses review; see below | | `obliterate` | Permanently remove content from the server | Destructive and irreversible | | `presign` | Issue presigned download URLs | Meant for services | | `migrate` | Administrative lock operations | Rarely needed | **No human preset includes `push-protected`.** On a review-gated branch, lore-forge's own landing identity is the only holder, which is what makes the gate enforceable. A CI service account can be given it explicitly. See [forge-features.md](forge-features.md). ## Grants A grant gives a subject a preset, plus optional extra actions, on a repository. - **Subjects:** a user, a team, or a service account (which is a user row, so it is granted by its `.` username). - **Who manages them:** holders of the `admin` action on the repository (the Admin and Owner presets) on its Access page. Only Owner holders can grant Owner. Every change is audited. - **Sources of a user's access to a repository**, combined by union: 1. the repository is in their personal namespace (Owner); 2. their organisation role and the organisation's base permission; 3. grants to teams they belong to; 4. direct grants as a collaborator. - **Resolution** produces the set of Lore actions that goes into the repository-scoped token. It happens at token exchange time; see [token-issuer.md](token-issuer.md). - **Changes apply within five minutes**, when the client's current scoped token expires. Resolution is on the hot path of every token exchange, so it must be answerable from a small number of indexed reads. ## Mapping from GitHub and Discord (later) Recommended and not yet designed in detail: an organisation can be linked to a GitHub organisation or a Discord server, with rules that map GitHub teams or Discord roles onto lore-forge teams. Membership would be synchronised periodically and on sign-in. This depends on a decision already made: provider tokens are not kept after sign-in. A synchronisation feature would need either an installed GitHub App or Discord bot acting for the organisation, or a change to that rule. Not part of phase 1. ## Open questions - Confirm who may create organisations. - Whether namespaces can be renamed (depends on Lore). - Whether repositories can be transferred between namespaces. - Visibility: whether a repository can be public to all signed-in users, or to anonymous visitors of the web UI. Lore itself has no anonymous access when authentication is enabled. - The exact organisation-level roles beyond owner and member.