From fc5e13ae525cb74e77a5bc51204f44476115cea9 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sun, 1 Oct 2023 00:38:29 +0200 Subject: draft for permission framework --- server/src/database.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'server/src/database.rs') 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, } -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct User { - pub name: String, - pub display_name: String, - pub password: Vec, - pub admin: bool, -} - impl Database { pub fn open(path: &Path) -> Result { 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(); -- cgit v1.2.3-70-g09d2