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

Function format_allow_rule

crates/openshell-tui/src/ui/sandbox_draft.rs:598–626  ·  view source on GitHub ↗
(allow: &L7Allow)

Source from the content-addressed store, hash-verified

596}
597
598fn format_allow_rule(allow: &L7Allow) -> String {
599 let mut parts = Vec::new();
600 if !allow.method.is_empty() || !allow.path.is_empty() {
601 parts.push(format!(
602 "{} {}",
603 non_empty_or(&allow.method, "*"),
604 non_empty_or(&allow.path, "*")
605 ));
606 }
607 if !allow.command.is_empty() {
608 parts.push(format!("command {}", allow.command));
609 }
610 if !allow.operation_type.is_empty() || !allow.operation_name.is_empty() {
611 parts.push(format!(
612 "graphql {} {}",
613 non_empty_or(&allow.operation_type, "*"),
614 non_empty_or(&allow.operation_name, "*")
615 ));
616 }
617 if !allow.fields.is_empty() {
618 parts.push(format!("fields {}", allow.fields.join(",")));
619 }
620 append_query_matchers(&mut parts, &allow.query);
621 if parts.is_empty() {
622 "*".to_string()
623 } else {
624 parts.join("; ")
625 }
626}
627
628fn format_deny_rule(deny: &L7DenyRule) -> String {
629 let mut parts = Vec::new();

Callers

nothing calls this directly

Calls 3

append_query_matchersFunction · 0.85
pushMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected