systemprompt-models 0.77.0

Foundation data models for systemprompt.io AI governance infrastructure. Shared DTOs, config, and domain types consumed by every layer of the MCP governance pipeline.
Documentation
//! Built-in role name constants.
//!
//! Copyright (c) systemprompt.io — Business Source License 1.1.
//! See <https://systemprompt.io> for licensing details.

use super::permission::Permission;

#[derive(Debug, Copy, Clone)]
pub struct BaseRoles;

impl BaseRoles {
    pub const ANONYMOUS: &'static str = "anonymous";
    pub const USER: &'static str = "user";
    pub const ADMIN: &'static str = "admin";

    #[must_use]
    pub fn permission_for(roles: &[String]) -> Permission {
        if roles.iter().any(|role| role == Self::ADMIN) {
            Permission::Admin
        } else {
            Permission::User
        }
    }
}