diff --git a/internal/repository/node.go b/internal/repository/node.go index c2cc950..0bd92f6 100644 --- a/internal/repository/node.go +++ b/internal/repository/node.go @@ -51,7 +51,10 @@ func (r *NodeRepository) List(ctx context.Context, userID string, subordinateIDs switch scope { case "shared": - where = append(where, `n.owner_user_id <> $1 AND ( + if parentID == nil || *parentID == "" { + where = append(where, "n.owner_user_id <> $1") + } + where = append(where, `( has_node_access(n.id, $1) OR n.owner_user_id::text = ANY($2::text[]) )`)