Skip to content
Clone
eba4fd1
21 lines 636 B Rust
use std::sync::OnceLock;
use uuid::Uuid;
static SYSTEM_UID: OnceLock<Uuid> = OnceLock::new();
/// Register the platform system actor (AI bot) that MCP internal keys act as.
/// Once set, every authorization check treats this uid as the owner of every
/// space and repository. The account is a bot with login prohibited, so it can
/// only ever be reached through the internal MCP key path.
pub fn set_system_uid(uid: Uuid) {
let _ = SYSTEM_UID.set(uid);
}
pub fn system_uid() -> Option<Uuid> {
SYSTEM_UID.get().copied()
}
pub fn is_system_uid(uid: Uuid) -> bool {
SYSTEM_UID.get().is_some_and(|value| *value == uid)
}