1
0
mirror of https://github.com/aziascreations/BakaShrot.git synced 2026-11-23 20:58:46 +01:00

Added the list_topics and list_nodes role flags, Filtered the nodes listed by the roles

- `list_topics` / `list_nodes`: listing answers every topic, every node
  with messages, without reading any (`query` gives both).
- Without them, listing nodes only answers those with messages in the
  topics the roles may read (every node until now).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 01:40:01 +01:00
parent cf8264b21d
commit c86dc8798e
14 changed files with 122 additions and 31 deletions
+13 -1
View File
@@ -164,7 +164,19 @@ accept_nodes = ["garage"]
assert!(both.can_read("Logs"));
assert!(!both.can_read("sensors.garage"));
assert!(!both.can_query());
assert!(config.permissions(&["admin"]).unwrap().can_query());
assert!(!both.lists_every_topic() && !both.lists_every_node());
let admin = config.permissions(&["admin"]).unwrap();
assert!(admin.can_query());
// A query reads them all anyway.
assert!(admin.lists_every_topic() && admin.lists_every_node());
let listing = Config::parse(&with(
"[roles.a]\nlist_topics = true\n[roles.b]\nlist_nodes = true\n",
))
.unwrap();
let a = listing.permissions(&["a"]).unwrap();
assert!(a.lists_every_topic() && !a.lists_every_node() && !a.can_query());
let b = listing.permissions(&["b", "a"]).unwrap();
assert!(b.lists_every_topic() && b.lists_every_node());
// Replication: each role's topics with that role's nodes, not mixed.
let peer = config.permissions(&["peer", "backup"]).unwrap();