summaryrefslogtreecommitdiff
path: root/src/scopes/admin.rs
diff options
context:
space:
mode:
authormrw1593 <botahamec@outlook.com>2023-06-03 11:35:22 -0400
committermrw1593 <botahamec@outlook.com>2023-06-03 11:35:22 -0400
commitd8d5650cc4d232215dce109f8aa3f0161079bf42 (patch)
treea565b09261495989137fcebf38775438e3e96038 /src/scopes/admin.rs
parent346978d0b6e1a433b108358ff841a7ece938db7a (diff)
Set up scoping service
Diffstat (limited to 'src/scopes/admin.rs')
-rw-r--r--src/scopes/admin.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/scopes/admin.rs b/src/scopes/admin.rs
new file mode 100644
index 0000000..1e13b85
--- /dev/null
+++ b/src/scopes/admin.rs
@@ -0,0 +1,28 @@
+use std::fmt::{self, Display};
+
+use crate::models::{client::Client, user::User};
+
+use super::{Action, Scope};
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+pub struct Admin;
+
+impl Display for Admin {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.write_str("admin")
+ }
+}
+
+impl Scope for Admin {
+ fn parse_modifiers(_modifiers: &str) -> Result<Self, Box<str>> {
+ Ok(Self)
+ }
+
+ fn has_user_permission(&self, _: &User, _: &Action<User>) -> bool {
+ true
+ }
+
+ fn has_client_permission(&self, _: &User, _: &Action<Client>) -> bool {
+ true
+ }
+}