garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /docs/notes/permissions.md

raw


topic: permissions triggers: [permissions.rs, roles.rs, Permission, PermissionSet, "roles", "role", require, caller_permissions, is_operator, admin_only, "/api/admin/roles", "/api/admin/permissions", account_roles, role_permissions, V27, "player role", may_edit, may_script] updated: 2026-10-06

Roles and permissions

Until 2026-10-06 a server had two kinds of account: an admin (the accounts.admin flag, V8) who could do everything, and a player who could do whatever the code happened to allow. Now every decision names a permission from one closed list (cartopolis_core::permissions), and an account holds permissions through roles an operator edits in the web UI's Roles tab (migration V27, simulator::roles).

The model

Freshness

HTTP reads the account's permissions per request (http::caller_permissions), so taking a role away works on the next call.

The game connection reads them at sign-in. It keeps that copy rather than reading the database per edit, because UpdatePrim arrives at the gizmo's drag rate. Since protocol 35 the copy is kept current:

The client uses that list (AuthIdentity::may) only to decide what to offer — for example, the building card's "Replace with a model" button, shown only with building_override. Disabling an account empties its permissions at once, and revokes its tokens, which ends its open connections within token_check_ms.

Two permissions are trust, not features

What changed behaviour

Not done