pub enum CommandPermission {
Allowed,
Denied(String),
RequiresApproval {
grant_pattern: String,
description: String,
},
}Expand description
Result of a command permission check (trait-level type).
This is a simplified, runtime-independent version suitable for trait boundaries.
Runtime implementations that need HIL integration use CommandCheckResult
(in orcs-runtime) which includes ApprovalRequest.
§Variants
Allowed: Command can execute immediatelyDenied: Command is permanently blocked (e.g., denylist)RequiresApproval: Command needs user approval before execution
§Example
use orcs_auth::CommandPermission;
let perm = CommandPermission::Allowed;
assert!(perm.is_allowed());
let perm = CommandPermission::Denied("blocked pattern".to_string());
assert!(perm.is_denied());
assert_eq!(perm.status_str(), "denied");
let perm = CommandPermission::RequiresApproval {
grant_pattern: "rm -rf".to_string(),
description: "destructive operation".to_string(),
};
assert!(perm.requires_approval());Variants§
Allowed
Command is allowed to execute.
Denied(String)
Command is denied with a reason.
RequiresApproval
Command requires user approval via HIL.
Implementations§
Source§impl CommandPermission
impl CommandPermission
Sourcepub fn is_allowed(&self) -> bool
pub fn is_allowed(&self) -> bool
Returns true if the command is allowed.
Sourcepub fn requires_approval(&self) -> bool
pub fn requires_approval(&self) -> bool
Returns true if the command requires approval.
Sourcepub fn status_str(&self) -> &'static str
pub fn status_str(&self) -> &'static str
Returns the status as a string (“allowed”, “denied”, “requires_approval”).
Trait Implementations§
Source§impl Clone for CommandPermission
impl Clone for CommandPermission
Source§fn clone(&self) -> CommandPermission
fn clone(&self) -> CommandPermission
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommandPermission
impl Debug for CommandPermission
Source§impl PartialEq for CommandPermission
impl PartialEq for CommandPermission
impl Eq for CommandPermission
impl StructuralPartialEq for CommandPermission
Auto Trait Implementations§
impl Freeze for CommandPermission
impl RefUnwindSafe for CommandPermission
impl Send for CommandPermission
impl Sync for CommandPermission
impl Unpin for CommandPermission
impl UnsafeUnpin for CommandPermission
impl UnwindSafe for CommandPermission
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
Mutably borrows from an owned value. Read more
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§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
Compare self to
key and return true if they are equal.