Skip to main content

zaun_community_protocol/
permissions.rs

1//! Permission resolution and the management hierarchy (`permissions.md`).
2//!
3//! Pure functions over plain data. The engine is authoritative; clients may run the same
4//! functions to drive their UI.
5//!
6//! Typical use for one command:
7//! 1. [`gate`] (or [`gate_unbound`]) on the member's state and the command's wire name;
8//! 2. [`required`] for the command's [`Requirement`];
9//! 3. a [`Resolver`] built once per member, then [`Resolver::community`] or
10//!    [`Resolver::channel`] for the requirement's scope, and [`Requirement::check`];
11//! 4. the command's hierarchy check ([`roles`], [`members`], [`overrides`], [`invites`],
12//!    [`safety`]) with [`Resolver::party`] for actor and target.
13//!
14//! Further pure checks that are plain bit tests on a resolved set are left to the engine:
15//! `channel.create` under a parent and moving a channel into a category need
16//! `MANAGE_CHANNELS` in the parent's `chp` too (ยง4.4).
17
18mod denial;
19mod gate;
20mod hierarchy;
21mod input;
22mod lockdown;
23mod requirement;
24mod resolve;
25mod resolved;
26mod restrict;
27mod table;
28
29pub mod invites;
30pub mod members;
31pub mod overrides;
32pub mod roles;
33pub mod safety;
34
35pub use denial::{ConflictReason, Denial, DenialReason, Invalid, Refusal};
36pub use gate::{
37    GateDenial, PENDING_ALLOWED, SUSPENDED_ALLOWED, UNBOUND_ALLOWED, UNBOUND_ONLY, gate,
38    gate_unbound,
39};
40pub use hierarchy::{Party, Top, act_on, h1, h2, h3, h3_owner_only, h4, no_new_unknown};
41pub use input::{Channel, Context, Override, OverrideTarget, Role, Subject};
42pub use lockdown::{
43    EXPENSIVE_HISTORY_DEPTH, EXPENSIVE_MEMBER_PAGE, Lockdown, LockdownRestrictions,
44};
45pub use requirement::{Access, Requirement, Scope};
46pub use resolve::{
47    ALL, LOCK_MASK, TIMEOUT_KEEP, all_in, applicable, base, channel_grants, community_dependencies,
48    dependencies, with_dependants,
49};
50pub use resolved::{Resolved, Steps};
51pub use restrict::{DM_GRANTS, DM_IF_GRANTED, Resolver, WAITING_MASK};
52pub use safety::ActiveLockdown;
53pub use table::{TABLE, commands, required};