From 75d03195d937db6188a4aaeb757de56b33a28174 Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 1 May 2024 17:47:21 +0200 Subject: [PATCH] feat: allow checking if identity is someone --- src/server/auth.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/server/auth.rs b/src/server/auth.rs index 8c124fb..95d57b7 100644 --- a/src/server/auth.rs +++ b/src/server/auth.rs @@ -38,6 +38,14 @@ impl Identity { } } + pub fn is(&self, id: &str) -> bool { + match self { + Identity::Anonymous => false, + Identity::Remote(_) => false, // TODO per-actor server auth should check this + Identity::Local(uid) => uid.as_str() == id + } + } + pub fn is_anon(&self) -> bool { matches!(self, Self::Anonymous) }