aboutsummaryrefslogtreecommitdiffstats
path: root/src/document
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-07 22:35:09 +0100
committertv <tv@krebsco.de>2026-11-07 22:35:09 +0100
commit7dbb95d6c1dd7245e50d3aaadd26ee24f3506ba1 (patch)
tree2fca159bf54cc1f5483a00b5dea072c9b8b68908 /src/document
parent42f67c3c35c90011d215744bf9a42123d6650e17 (diff)
access: the user registry
_continuum/users/<name>: 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.
Diffstat (limited to 'src/document')
-rw-r--r--src/document/meta.rs3
-rw-r--r--src/document/store.rs5
2 files changed, 8 insertions, 0 deletions
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/<name>`: 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/<parts…>`.
pub(crate) fn path(parts: &[&str]) -> Vec<String> {
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<Vec<String>, StoreError> {
Ok(match resolve_through(doc, path)? {