From 925f566990fdd4043df691b3277a2a50b937ec1b Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 9 Nov 2026 22:24:45 +0000 Subject: access: a limit that meets none of the user's capabilities gives nothing to look with Looking at a node (its figures, peers, dashboard: Need::Observe) takes any capability, a token's limit applied. Caps::is_empty is now true where no capability of the user meets one of the limit's (Capability::meet), as well as where there are none: a token limited to the member list, for a user who may only read data/eu, may not look. --- src/access/mod.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/access/mod.rs') diff --git a/src/access/mod.rs b/src/access/mod.rs index ad50c72..cc6b7a2 100644 --- a/src/access/mod.rs +++ b/src/access/mod.rs @@ -197,8 +197,16 @@ impl Caps { self.limit.is_some() } + /// Whether they give nothing: none at all, or none that a token's limit meets + /// somewhere (`Capability::meet`). pub(crate) fn is_empty(&self) -> bool { - self.caps.is_empty() || self.limit.as_ref().is_some_and(Vec::is_empty) + match &self.limit { + None => self.caps.is_empty(), + Some(limit) => !self + .caps + .iter() + .any(|cap| limit.iter().any(|outer| cap.meet(outer).is_some())), + } } } -- cgit v1.3.1