aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/Cargo.toml10
-rw-r--r--base/src/database.rs21
-rw-r--r--base/src/permission.rs6
3 files changed, 16 insertions, 21 deletions
diff --git a/base/Cargo.toml b/base/Cargo.toml
index be32dce..b9e47de 100644
--- a/base/Cargo.toml
+++ b/base/Cargo.toml
@@ -6,18 +6,18 @@ edition = "2021"
[dependencies]
jellycommon = { path = "../common" }
jellyclient = { path = "../client" }
-serde = { version = "1.0.214", features = ["derive"] }
+serde = { version = "1.0.217", features = ["derive"] }
serde_yaml = "0.9.34"
log = { workspace = true }
sha2 = "0.10.8"
base64 = "0.22.1"
tokio = { workspace = true }
-anyhow = "1.0.92"
+anyhow = "1.0.95"
bincode = "2.0.0-rc.3"
-rand = "0.8.5"
-redb = "2.2.0"
+rand = "0.9.0"
+redb = "2.4.0"
tantivy = "0.22.0"
-serde_json = "1.0.132"
+serde_json = "1.0.138"
aes-gcm-siv = "0.11.1"
[features]
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;
}