pub struct Policy {
pub rules: Vec<Rule>,
pub groups: BTreeMap<String, Vec<String>>,
pub relay_grants: BTreeMap<String, RelayGrant>,
pub admin_grants: BTreeMap<String, AdminGrant>,
pub group_admin_grants: BTreeMap<String, GroupAdminGrant>,
}Fields§
§rules: Vec<Rule>§groups: BTreeMap<String, Vec<String>>Signed membership, changed by the owner or a separately delegated chat.
relay_grants: BTreeMap<String, RelayGrant>Legacy relay authorizations, retained to verify existing signed state. New relay selections use ordinary messaging permissions alone.
admin_grants: BTreeMap<String, AdminGrant>Editing authority is separate from message permissions. Empty maps keep previously signed policy bytes unchanged.
group_admin_grants: BTreeMap<String, GroupAdminGrant>Implementations§
Source§impl Policy
impl Policy
pub fn group_admin_allows( &self, grant: &GroupAdminGrant, administrator: &Agent, member: &Agent, action: GroupAction, now: u64, ) -> bool
pub fn admin_allows( &self, grant: &AdminGrant, administrator: &Agent, actor: &Agent, peer: &Agent, permission: Permission, now: u64, ) -> bool
Sourcepub fn apply_permission_changes(&mut self, changes: &[PermissionChange])
pub fn apply_permission_changes(&mut self, changes: &[PermissionChange])
Caller must authenticate and validate the ENTIRE batch against the original policy before invoking this. Only exact chat-pair rules change.
pub fn apply_permission_rules(&mut self, changes: &[PermissionRuleChange])
pub fn admin_allows_rule( &self, grant: &AdminGrant, administrator: &Agent, change: &PermissionRuleChange, known: &BTreeMap<String, Agent>, now: u64, ) -> bool
Source§impl Policy
impl Policy
Sourcepub fn cluster_default() -> Self
pub fn cluster_default() -> Self
New clusters permit ordinary communication and use deny rules to restrict it. Explicit wildcard rules also work on older nodes. Keep the empty Default policy unchanged so loading an existing signed policy never broadens it.
pub fn relationship(&self, actor: &Agent, peer: &Agent) -> Relationship
pub fn trace(&self, actor: &Agent, peer: &Agent) -> Vec<Trace>
Source§impl Policy
impl Policy
Sourcepub fn decision(
&self,
actor: &Agent,
peer: &Agent,
permission: Permission,
) -> Option<Effect>
pub fn decision( &self, actor: &Agent, peer: &Agent, permission: Permission, ) -> Option<Effect>
None means default denial; it is distinct from an explicit denial for reply grants.