diff --git a/lib/Service/RowService.php b/lib/Service/RowService.php index a5f12eb78f..11cabfc986 100644 --- a/lib/Service/RowService.php +++ b/lib/Service/RowService.php @@ -103,7 +103,15 @@ public function findAllByView(int $viewId, string $userId, ?int $limit = null, ? if ($this->permissionsService->canReadRowsByElementId($viewId, 'view', $userId)) { $view = $this->viewMapper->find($viewId); - return $this->row2Mapper->findAll($view->getColumnIds(), $view->getTableId(), $limit, $offset, $view->getFilterArray(), $view->getSortArray(), $userId); + return $this->row2Mapper->findAll( + $view->getColumnIds(), + $view->getTableId(), + $limit, + $offset, + $view->getFilterArray(), + $view->getSortArray(), + $this->resolveFilterUserId($userId, $view), + ); } else { throw new PermissionError('no read access to view id = ' . $viewId); } @@ -114,6 +122,18 @@ public function findAllByView(int $viewId, string $userId, ?int $limit = null, ? } + /** + * resolve user id used for field placeholders in view filters. + * if no user is in context (public link), use the view owner as fallback. + */ + private function resolveFilterUserId(string $userId, View $view): string { + if (in_array($userId, ['', null], true)) { + return $view->getCreatedBy() ?? ''; + } + + return $userId; + } + /** * @param int $rowId * @return Row2