MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / scoped_access_allowed

Function scoped_access_allowed

crates/openshell-server/src/auth/authz.rs:316–370  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

314
315 #[test]
316 fn scoped_access_allowed() {
317 let id =
318 identity_with_roles_and_scopes(&["openshell-user"], &["sandbox:read", "sandbox:write"]);
319 let policy = scoped_policy();
320 assert!(
321 policy
322 .check(&id, "/openshell.v1.OpenShell/ListSandboxes")
323 .is_ok()
324 );
325 assert!(
326 policy
327 .check(&id, "/openshell.v1.OpenShell/ListSandboxProviders")
328 .is_ok()
329 );
330 assert!(
331 policy
332 .check(&id, "/openshell.v1.OpenShell/ListServices")
333 .is_ok()
334 );
335 assert!(
336 policy
337 .check(&id, "/openshell.v1.OpenShell/GetService")
338 .is_ok()
339 );
340 assert!(
341 policy
342 .check(&id, "/openshell.v1.OpenShell/CreateSandbox")
343 .is_ok()
344 );
345 assert!(
346 policy
347 .check(&id, "/openshell.v1.OpenShell/ForwardTcp")
348 .is_ok()
349 );
350 assert!(
351 policy
352 .check(&id, "/openshell.v1.OpenShell/ExposeService")
353 .is_ok()
354 );
355 assert!(
356 policy
357 .check(&id, "/openshell.v1.OpenShell/DeleteService")
358 .is_ok()
359 );
360 assert!(
361 policy
362 .check(&id, "/openshell.v1.OpenShell/AttachSandboxProvider")
363 .is_ok()
364 );
365 assert!(
366 policy
367 .check(&id, "/openshell.v1.OpenShell/DetachSandboxProvider")
368 .is_ok()
369 );
370 }
371
372 #[test]
373 fn scoped_access_denied() {

Callers

nothing calls this directly

Calls 2

scoped_policyFunction · 0.85

Tested by

no test coverage detected