From 64b6c0be3690649e6c73f33ccaac13a26679defa Mon Sep 17 00:00:00 2001 From: Ghassen kefi Date: Tue, 1 Sep 2026 20:34:33 +0200 Subject: [PATCH] fix: filter system tag object IDs by user visibility Signed-off-by: Ghassen kefi --- apps/dav/lib/SystemTag/SystemTagPlugin.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/dav/lib/SystemTag/SystemTagPlugin.php b/apps/dav/lib/SystemTag/SystemTagPlugin.php index 0eed4334f29c6..18d40a776692f 100644 --- a/apps/dav/lib/SystemTag/SystemTagPlugin.php +++ b/apps/dav/lib/SystemTag/SystemTagPlugin.php @@ -291,7 +291,22 @@ public function handleGetProperties( if ($node instanceof SystemTagObjectType) { $propFind->handle(self::OBJECTIDS_PROPERTYNAME, function () use ($node): SystemTagsObjectList { - return new SystemTagsObjectList(array_fill_keys($node->getObjectsIds(), $node->getName())); + $user = $this->userSession->getUser(); + if ($user === null) { + return new SystemTagsObjectList([]); + } + + $allIds = $node->getObjectsIds(); + $userFolder = $this->rootFolder->getUserFolder($user->getUID()); + $filteredIds = []; + foreach ($allIds as $id) { + if ($userFolder->getFirstNodeById((int)$id) !== null) { + $filteredIds[] = $id; + } + } + return new SystemTagsObjectList( + array_fill_keys($filteredIds, $node->getName()) + ); }); } }