aboutsummaryrefslogtreecommitdiff
path: root/base/src
diff options
context:
space:
mode:
Diffstat (limited to 'base/src')
-rw-r--r--base/src/database.rs21
-rw-r--r--base/src/permission.rs6
2 files changed, 11 insertions, 16 deletions
diff --git a/base/src/database.rs b/base/src/database.rs
index e57ea3e..a6bcdf7 100644
--- a/base/src/database.rs
+++ b/base/src/database.rs
@@ -7,7 +7,7 @@ use anyhow::Context;
use bincode::{Decode, Encode};
use jellycommon::{
user::{NodeUserData, User},
- ExtendedNode, Node,
+ Node,
};
use log::info;
use redb::{Database, TableDefinition};
@@ -33,11 +33,6 @@ pub const T_USER_NODE: TableDefinition<(&str, &str), Ser<NodeUserData>> =
TableDefinition::new("user_node");
pub const T_INVITE: TableDefinition<&str, Ser<()>> = TableDefinition::new("invite");
pub const T_NODE: TableDefinition<&str, Ser<Node>> = TableDefinition::new("node");
-pub const T_NODE_EXTENDED: TableDefinition<&str, Ser<ExtendedNode>> =
- TableDefinition::new("node-ext");
-#[allow(clippy::type_complexity)]
-pub const T_NODE_IMPORT: TableDefinition<&str, Ser<Vec<(Vec<usize>, Node)>>> =
- TableDefinition::new("node-import");
#[derive(Clone)]
pub struct DataAcid {
@@ -64,8 +59,6 @@ impl DataAcid {
drop(txn.open_table(T_USER)?);
drop(txn.open_table(T_USER_NODE)?);
drop(txn.open_table(T_NODE)?);
- drop(txn.open_table(T_NODE_IMPORT)?);
- drop(txn.open_table(T_NODE_EXTENDED)?);
txn.commit()?;
}
@@ -205,10 +198,12 @@ where
pub struct Ser<T>(pub T);
#[cfg(not(feature = "db_json"))]
impl<T: Encode + Decode + std::fmt::Debug> redb::Value for Ser<T> {
- type SelfType<'a> = Ser<T>
+ type SelfType<'a>
+ = Ser<T>
where
Self: 'a;
- type AsBytes<'a> = Vec<u8>
+ type AsBytes<'a>
+ = Vec<u8>
where
Self: 'a;
@@ -243,10 +238,12 @@ impl<T: Encode + Decode + std::fmt::Debug> redb::Value for Ser<T> {
pub struct Ser<T>(pub T);
#[cfg(feature = "db_json")]
impl<T: Serialize + for<'a> Deserialize<'a> + std::fmt::Debug> redb::Value for Ser<T> {
- type SelfType<'a> = Ser<T>
+ type SelfType<'a>
+ = Ser<T>
where
Self: 'a;
- type AsBytes<'a> = Vec<u8>
+ type AsBytes<'a>
+ = Vec<u8>
where
Self: 'a;
diff --git a/base/src/permission.rs b/base/src/permission.rs
index 358202f..11668a2 100644
--- a/base/src/permission.rs
+++ b/base/src/permission.rs
@@ -51,12 +51,10 @@ impl NodePermissionExt for Option<Node> {
}
}
fn check_node_permission(perms: &PermissionSet, node: &Node) -> bool {
- if let Some(v) =
- perms.check_explicit(&UserPermission::AccessNode(node.public.id.clone().unwrap()))
- {
+ if let Some(v) = perms.check_explicit(&UserPermission::AccessNode(node.id.clone().unwrap())) {
v
} else {
- for com in node.public.path.clone().into_iter().rev() {
+ for com in node.parents.clone().into_iter() {
if let Some(v) = perms.check_explicit(&UserPermission::AccessNode(com.to_owned())) {
return v;
}