aboutsummaryrefslogtreecommitdiff
path: root/server/src/database.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/database.rs')
-rw-r--r--server/src/database.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/server/src/database.rs b/server/src/database.rs
index d5a435f..6c3b938 100644
--- a/server/src/database.rs
+++ b/server/src/database.rs
@@ -6,9 +6,11 @@
use crate::routes::ui::account::hash_password;
use anyhow::Context;
use jellybase::CONF;
-use jellycommon::Node;
+use jellycommon::{
+ user::{PermissionSet, User},
+ Node,
+};
use log::info;
-use serde::{Deserialize, Serialize};
use std::path::Path;
use typed_sled::Tree;
@@ -20,14 +22,6 @@ pub struct Database {
pub node: Tree<String, Node>,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct User {
- pub name: String,
- pub display_name: String,
- pub password: Vec<u8>,
- pub admin: bool,
-}
-
impl Database {
pub fn open(path: &Path) -> Result<Self, anyhow::Error> {
info!("opening database… (might take up to O(n) time)");
@@ -51,6 +45,7 @@ impl Database {
display_name: "Admin".to_string(),
name: CONF.admin_username.clone(),
password: hash_password(&CONF.admin_username, &CONF.admin_password),
+ permissions: PermissionSet::default(),
},
)
.unwrap();