From 7dbb95d6c1dd7245e50d3aaadd26ee24f3506ba1 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 7 Nov 2026 22:35:09 +0100 Subject: access: the user registry _continuum/users/: one entry per user, with capabilities by path (read, write) granted by whom and when, and a disabled flag. Read leniently: a damaged entry gives less, never more. Protocol data stays apart: a capability outside _continuum never covers it. Auth plan M1. --- src/document/meta.rs | 3 +++ src/document/store.rs | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'src/document') diff --git a/src/document/meta.rs b/src/document/meta.rs index a60efc1..0c3ee89 100644 --- a/src/document/meta.rs +++ b/src/document/meta.rs @@ -14,6 +14,8 @@ //! * `topology`, `dissemination`: how members' neighbours are chosen, and how a change //! reaches every member, written by the genesis node, and changed by a protocol //! writer if need be (`swarm::topology::swarm_ways`). +//! * `users/`: the user registry: who the users are, and what each may do +//! (`access::registry`). /// The key every protocol path starts with. pub(crate) const ROOT: &str = "_continuum"; @@ -27,6 +29,7 @@ pub(crate) const NEIGHBOURS: &str = "neighbours"; pub(crate) const RELAYS: &str = "relays"; pub(crate) const TOPOLOGY: &str = "topology"; pub(crate) const DISSEMINATION: &str = "dissemination"; +pub(crate) const USERS: &str = "users"; /// The store path `_continuum/`. pub(crate) fn path(parts: &[&str]) -> Vec { diff --git a/src/document/store.rs b/src/document/store.rs index f18f2fa..db5ecbc 100644 --- a/src/document/store.rs +++ b/src/document/store.rs @@ -650,6 +650,11 @@ fn summary( Ok(JsonValue::Object(out)) } +/// Whether `path` holds a map (one, or concurrent ones merged). +pub(crate) fn is_map(doc: &impl ReadDoc, path: &[String]) -> bool { + matches!(resolve_through(doc, path), Ok(Some(Resolved::Maps(_)))) +} + /// Keys of the merged map at `path`; empty if it doesn't exist or isn't a map. pub(crate) fn keys_at(doc: &impl ReadDoc, path: &[String]) -> Result, StoreError> { Ok(match resolve_through(doc, path)? { -- cgit v1.3.1