diff options
author | metamuffin <metamuffin@disroot.org> | 2023-10-01 00:38:29 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-10-01 00:38:29 +0200 |
commit | fc5e13ae525cb74e77a5bc51204f44476115cea9 (patch) | |
tree | a20b6d296d67735a2c8d42a0dc31b44c0bb53cb7 /server/src/database.rs | |
parent | d546caa3f5053ade763430490911fefd6257af9f (diff) | |
download | jellything-fc5e13ae525cb74e77a5bc51204f44476115cea9.tar jellything-fc5e13ae525cb74e77a5bc51204f44476115cea9.tar.bz2 jellything-fc5e13ae525cb74e77a5bc51204f44476115cea9.tar.zst |
draft for permission framework
Diffstat (limited to 'server/src/database.rs')
-rw-r--r-- | server/src/database.rs | 15 |
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(); |