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

Function scope_composition

nodedb/src/control/security/scope/store.rs:253–284  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

251
252 #[test]
253 fn scope_composition() {
254 let store = ScopeStore::new();
255 store
256 .define(
257 "profile:read",
258 vec![("read".into(), "profiles".into())],
259 vec![],
260 "admin",
261 )
262 .unwrap();
263 store
264 .define(
265 "orders:write",
266 vec![("write".into(), "orders".into())],
267 vec![],
268 "admin",
269 )
270 .unwrap();
271 store
272 .define(
273 "customer",
274 vec![],
275 vec!["profile:read".into(), "orders:write".into()],
276 "admin",
277 )
278 .unwrap();
279
280 let resolved = store.resolve("customer");
281 assert_eq!(resolved.len(), 2);
282 assert!(resolved.contains(&("read".into(), "profiles".into())));
283 assert!(resolved.contains(&("write".into(), "orders".into())));
284 }
285
286 #[test]
287 fn cycle_detection() {

Callers

nothing calls this directly

Calls 2

defineMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected