ai_agent/utils/permissions/
permission_rule.rs1#![allow(dead_code)]
3
4use serde::{Deserialize, Serialize};
7
8pub use crate::types::permissions::{
10 PermissionBehavior, PermissionRule, PermissionRuleSource, PermissionRuleValue,
11};
12
13#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
18#[serde(rename_all = "lowercase")]
19pub enum PermissionBehaviorSchema {
20 Allow,
21 Deny,
22 Ask,
23}
24
25impl From<PermissionBehavior> for PermissionBehaviorSchema {
26 fn from(behavior: PermissionBehavior) -> Self {
27 match behavior {
28 PermissionBehavior::Allow => PermissionBehaviorSchema::Allow,
29 PermissionBehavior::Deny => PermissionBehaviorSchema::Deny,
30 PermissionBehavior::Ask => PermissionBehaviorSchema::Ask,
31 }
32 }
33}
34
35impl From<PermissionBehaviorSchema> for PermissionBehavior {
36 fn from(schema: PermissionBehaviorSchema) -> Self {
37 match schema {
38 PermissionBehaviorSchema::Allow => PermissionBehavior::Allow,
39 PermissionBehaviorSchema::Deny => PermissionBehavior::Deny,
40 PermissionBehaviorSchema::Ask => PermissionBehavior::Ask,
41 }
42 }
43}