feat: helper methods to handle auth cases
This commit is contained in:
parent
b3014c0175
commit
8721a44354
1 changed files with 21 additions and 0 deletions
|
@ -25,6 +25,27 @@ impl Identity {
|
||||||
// TODO should we allow all users on same server to see? or just specific user??
|
// 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);
|
pub struct AuthIdentity(pub Identity);
|
||||||
|
|
Loading…
Reference in a new issue