use async_trait::async_trait;
#[cfg(test)]
#[allow(deprecated)]
use super::AllowAllSwitchToGuard;
use super::{DenyAllSwitchToGuard, SwitchToGuard};
use crate::error::{GarrisonError, GarrisonResult};
#[async_trait]
impl SwitchToGuard for DenyAllSwitchToGuard {
async fn check(&self, _original: &str, _target: &str) -> GarrisonResult<()> {
Err(GarrisonError::NotPermission(
"switch_to 被拒绝:未配置 SwitchToGuard,默认 deny-all".to_string(),
))
}
}
#[cfg(test)]
#[allow(deprecated)]
#[async_trait]
impl SwitchToGuard for AllowAllSwitchToGuard {
async fn check(&self, _original: &str, _target: &str) -> GarrisonResult<()> {
Ok(())
}
}