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

Method resolve_recursive

nodedb/src/control/security/scope/store.rs:183–198  ·  view source on GitHub ↗
(
        scopes: &HashMap<String, ScopeDefinition>,
        name: &str,
        out: &mut Vec<(String, String)>,
        visited: &mut std::collections::HashSet<String>,
    )

Source from the content-addressed store, hash-verified

181 }
182
183 fn resolve_recursive(
184 scopes: &HashMap<String, ScopeDefinition>,
185 name: &str,
186 out: &mut Vec<(String, String)>,
187 visited: &mut std::collections::HashSet<String>,
188 ) {
189 if !visited.insert(name.to_string()) {
190 return; // Cycle detected — skip.
191 }
192 if let Some(def) = scopes.get(name) {
193 out.extend(def.grants.iter().cloned());
194 for inc in &def.includes {
195 Self::resolve_recursive(scopes, inc, out, visited);
196 }
197 }
198 }
199
200 /// Check if a scope grants a specific `(permission, collection)` pair.
201 pub fn scope_grants(&self, scope_name: &str, permission: &str, collection: &str) -> bool {

Callers

nothing calls this directly

Calls 5

to_stringMethod · 0.80
insertMethod · 0.45
getMethod · 0.45
extendMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected