From 997aafc646bd1230a2347663b69faa8b8619f468 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 10 Feb 2026 12:20:36 +0200 Subject: [PATCH] $join->setCollection --- .../Http/Databases/Collections/Documents/XList.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php index 295b78a114..4d2932f955 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php @@ -99,6 +99,17 @@ class XList extends Action throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } + $joins = Query::getJoinQueries($queries, false); + foreach ($joins as $join) { + $col = $authorization->skip(fn () => $dbForProject->getDocument('database_' . $database->getSequence(), $join->getCollection())); + + if ($col->isEmpty() || (!$col->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { + throw new Exception($this->getParentNotFoundException(), params: [$join->getCollection()]); + } + + $join->setCollection('database_' . $database->getSequence() . '_collection_' . $col->getSequence()); + } + $cursor = Query::getCursorQueries($queries, false); $cursor = \reset($cursor);