cal-core 0.2.158

Callable core lib
Documentation
// File: cal-core/src/authentication/permissions.rs

/// Check if a user has a specific permission
pub fn has_permission(groups: &[String], permission: &str) -> bool {
    groups.iter().any(|g| g == permission)
}

/// Check if a user is an admin
pub fn is_admin(groups: &[String]) -> bool {
    groups.contains(&"Admin".to_string())
}

/// Check if softphone is enabled based on agent settings
pub fn is_softphone_enabled(agent_settings: &Option<crate::AgentSettings>) -> bool {
    match agent_settings {
        Some(settings) => {
            settings.client.is_some() && settings.ddi.is_some()
        }
        None => false,
    }
}