diff --git a/src/backend/db_structures.rs b/src/backend/db_structures.rs
index c3fa7a1..fab0a98 100644
--- a/src/backend/db_structures.rs
+++ b/src/backend/db_structures.rs
@@ -8,4 +8,5 @@ pub struct ActivationTokensRow {
pub struct UsersRow {
pub userid: String,
pub password: String,
+ pub permissions: u16,
}
diff --git a/src/backend/mod.rs b/src/backend/mod.rs
index 597fc8a..2a72f52 100644
--- a/src/backend/mod.rs
+++ b/src/backend/mod.rs
@@ -1,5 +1,7 @@
mod db_structures;
pub mod error;
+mod permissions;
+mod user;
use crate::backend::error::AccountRegisterError;
use crate::config::Config;
@@ -11,6 +13,7 @@ use argon2::{
use db_structures::{ActivationTokensRow, UsersRow};
use log::info;
use sqlx::{types::chrono::Utc, MySqlPool};
+use user::User;
use uuid::Uuid;
#[derive(Debug, Clone)]
@@ -24,8 +27,9 @@ impl Backend {
sqlx::query!(
r#"CREATE TABLE IF NOT EXISTS Users (
- userid UUID NOT NULL PRIMARY KEY,
- password VARCHAR(128) NOT NULL
+ userid UUID NOT NULL PRIMARY KEY,
+ password VARCHAR(128) NOT NULL,
+ permissions SMALLINT UNSIGNED NOT NULL
);"#
)
.execute(&pool)
@@ -90,7 +94,7 @@ impl Backend {
}
}
- async fn get_user(&self, userid: Uuid) -> Result