1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Optional attribute-based access control (ABAC) for MobKit surfaces.
//!
//! The model is deliberately attribute-based rather than role-based: every
//! check evaluates the caller's attributes (subject, group membership)
//! against the resource's attributes (agent identity, role, labels) for a
//! specific action. There are no implicit role shortcuts — the closest
//! analogue is a [`AccessRule`] that bundles a group with a set of actions.
//!
//! # Model
//!
//! - A **principal** is the authenticated console caller: a `subject`
//! (email or token `sub`) plus the set of configured groups it belongs to.
//! - A **resource** is (usually) an agent: its identity, role, and labels.
//! - An **action** is a verb from the fixed vocabulary in [`ACCESS_ACTIONS`]
//! such as `agent.view`, `agent.send`, or `access.admin`.
//! - A **rule** matches a set of principals (subjects/groups), a set of
//! actions (with `*` wildcards), and a set of resources (agent ids, roles,
//! label selectors), and either allows or denies.
//!
//! # Evaluation
//!
//! Evaluation is deny-by-default and deny-overrides:
//!
//! 1. When the config is disabled, every check allows (feature off).
//! 2. Subjects listed in `admins` are allowed everything.
//! 3. Otherwise the matching rules decide: any matching `deny` rule denies,
//! else any matching `allow` rule allows, else the check denies.
//!
//! # Live configuration
//!
//! [`AccessController`] is the shared handle: it holds the current config
//! behind a lock, persists changes to a TOML file when configured with one,
//! and hands out cheap per-request [`AccessView`] snapshots. All admin
//! mutations (`mobkit/access/*` RPC methods) bump a revision so clients can
//! detect changes.
pub use ;
pub use ;
pub use ;