feat: helper methods to handle auth cases

This commit is contained in:
əlemi 2024-04-18 03:06:40 +02:00
parent b3014c0175
commit 8721a44354
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -25,6 +25,27 @@ impl Identity {
// TODO should we allow all users on same server to see? or just specific user??
}
}
pub fn is_anon(&self) -> bool {
match self {
Self::Anonymous => true,
_ => false,
}
}
pub fn is_user(&self, uid: &str) -> bool {
match self {
Self::Local(x) => x == uid,
_ => false,
}
}
pub fn is_server(&self, uid: &str) -> bool {
match self {
Self::Remote(x) => x == uid,
_ => false,
}
}
}
pub struct AuthIdentity(pub Identity);