aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/ui/node.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-10-04 20:41:59 +0200
committermetamuffin <metamuffin@disroot.org>2023-10-04 20:41:59 +0200
commit347274afb36e926b328e799ca8004fc874ffe4cb (patch)
tree8c7ec38938e3673ce5752bffa9442daa9f589f3d /server/src/routes/ui/node.rs
parent4095a8804c17c3ec12706f00d3694f564afc0b95 (diff)
downloadjellything-347274afb36e926b328e799ca8004fc874ffe4cb.tar
jellything-347274afb36e926b328e799ca8004fc874ffe4cb.tar.bz2
jellything-347274afb36e926b328e799ca8004fc874ffe4cb.tar.zst
more permission stuff
Diffstat (limited to 'server/src/routes/ui/node.rs')
-rw-r--r--server/src/routes/ui/node.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/src/routes/ui/node.rs b/server/src/routes/ui/node.rs
index 1a906f1..b72ec11 100644
--- a/server/src/routes/ui/node.rs
+++ b/server/src/routes/ui/node.rs
@@ -22,6 +22,7 @@ use crate::{
uri,
};
use anyhow::{anyhow, Context};
+use jellybase::permission::NodePermissionExt;
use jellycommon::{MediaInfo, NodeKind, NodePublic, Rating, SourceTrackKind};
use rocket::{get, serde::json::Json, Either, State};
@@ -39,11 +40,11 @@ pub async fn r_library_node_filter<'a>(
aj: AcceptJson,
filter: NodeFilterSort,
) -> Result<Either<DynLayoutPage<'a>, Json<NodePublic>>, MyError> {
- drop(session);
let node = db
.node
.get(&id.to_string())
.context("retrieving library node")?
+ .only_if_permitted(&session.user.permissions)
.ok_or(anyhow!("node does not exist"))?
.public;
@@ -124,7 +125,7 @@ markup::define! {
}
@if matches!(node.kind, NodeKind::Collection | NodeKind::Channel) {
@if matches!(node.kind, NodeKind::Collection) {
- @if let Some(parent) = &node.parent {
+ @if let Some(parent) = &node.path.last().cloned() {
a.dirup[href=uri!(r_library_node(parent))] { "Go up" }
}
}