pub enum PermissionMode {
Default,
AllowAsks,
}Expand description
What a run does with an ask it cannot put to a client.
Why: tcode run-task and a daemon run with nobody attached cannot prompt.
The default refuses; a scripted run that accepts the risk must say so.
What: Default refuses an unanswerable ask; AllowAsks treats every
ask as allow, logging and emitting each approval. Neither affects a
deny.
Test: headless_ask_is_denied, allow_asks_mode_permits_an_ask,
allow_asks_mode_emits_an_audit_event.
Variants§
Implementations§
Source§impl PermissionMode
impl PermissionMode
Sourcepub fn parse_lenient(s: &str) -> Option<Self>
pub fn parse_lenient(s: &str) -> Option<Self>
Parse a mode string leniently (case-insensitive, _/- interchangeable).
Test: permission_mode_parses_allow_asks_spellings.
Sourcepub fn resolve(cli: Option<&str>) -> Self
pub fn resolve(cli: Option<&str>) -> Self
Resolve the effective mode: CLI value, then PERMISSION_MODE_ENV,
then Default.
Test: cli_permission_mode_outranks_the_env_var.
Sourcepub fn resolve_from(cli: Option<&str>, env: Option<&str>) -> Self
pub fn resolve_from(cli: Option<&str>, env: Option<&str>) -> Self
PermissionMode::resolve with both tiers supplied.
Why: tests the precedence without mutating the process environment.
What: the first tier that parses wins; an unrecognised value contributes
nothing, and with no usable tier the result is Default — never a
widening.
Test: cli_permission_mode_outranks_the_env_var,
env_permission_mode_applies_when_no_flag_is_given,
unrecognised_permission_mode_falls_back_to_default.
Trait Implementations§
Source§impl Clone for PermissionMode
impl Clone for PermissionMode
impl Copy for PermissionMode
Source§impl Debug for PermissionMode
impl Debug for PermissionMode
Source§impl Default for PermissionMode
impl Default for PermissionMode
impl Eq for PermissionMode
Source§impl PartialEq for PermissionMode
impl PartialEq for PermissionMode
impl StructuralPartialEq for PermissionMode
Auto Trait Implementations§
impl Freeze for PermissionMode
impl RefUnwindSafe for PermissionMode
impl Send for PermissionMode
impl Sync for PermissionMode
impl Unpin for PermissionMode
impl UnsafeUnpin for PermissionMode
impl UnwindSafe for PermissionMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more