summaryrefslogtreecommitdiff
path: root/src/scopes/admin.rs
diff options
context:
space:
mode:
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
+ }
+}