MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / resolve

Method resolve

nodedb/src/control/security/predicate.rs:176–189  ·  view source on GitHub ↗

Resolve this value using the given `AuthContext`. - `Literal`: returned as-is. - `Field`: returned as-is (resolved at scan time by Data Plane). - `AuthRef`: resolved via `AuthContext::resolve_variable()`. - `AuthFunc`: resolved via `AuthContext` metadata (pre-computed). Returns `None` if an `AuthRef`/`AuthFunc` cannot be resolved.

(&self, auth: &AuthContext)

Source from the content-addressed store, hash-verified

174 ///
175 /// Returns `None` if an `AuthRef`/`AuthFunc` cannot be resolved.
176 pub fn resolve(&self, auth: &AuthContext) -> Option<serde_json::Value> {
177 match self {
178 Self::Literal(v) => Some(v.clone()),
179 Self::Field(_) => None,
180 Self::AuthRef(field) => auth.resolve_variable(field),
181 Self::AuthFunc { func, args } => {
182 // Functions are resolved via pre-computed metadata keys.
183 // e.g., scope_status('pro:all') → metadata["scope_status.pro:all"]
184 let arg = args.first().map(|s| s.as_str()).unwrap_or("");
185 let key = format!("{func}.{arg}");
186 auth.resolve_variable(&format!("metadata.{key}"))
187 }
188 }
189 }
190}
191
192/// Whether a policy is permissive (OR-combined) or restrictive (AND-combined).

Callers 8

substitute_containsFunction · 0.45
substitute_intersectsFunction · 0.45
explain_scopeFunction · 0.45
show_scopesFunction · 0.45
parse_key_scopesFunction · 0.45
handle_setMethod · 0.45

Calls 4

resolve_variableMethod · 0.80
firstMethod · 0.80
cloneMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected