Skip to main content

is_allowed_for_each

Function is_allowed_for_each 

Source
pub fn is_allowed_for_each(name: &str, mutating: bool) -> bool
Expand description

Whether name is a permitted ct-each dispatch target.

The base set is BUILTIN plus ct-test (which only runs read-only commands itself, so dispatching it stays read-only). With mutating, the suite’s MUTATING_SUITE tools are also permitted — and nothing else: arbitrary mutating commands are never runnable.

§Examples

use coding_tools::allowlist::is_allowed_for_each;

assert!(is_allowed_for_each("ct-view", false));
assert!(is_allowed_for_each("ct-test", false));  // itself gated read-only
assert!(!is_allowed_for_each("ct-edit", false)); // needs --mutating
assert!(is_allowed_for_each("ct-edit", true));
assert!(!is_allowed_for_each("rm", true));       // never, even with --mutating
assert!(!is_allowed_for_each("sh", true));       // no shell, ever