From cd88017b75fe30757747525b31ebfb164ea0eff9 Mon Sep 17 00:00:00 2001 From: Philipp Hempel Date: Mon, 31 Jul 2023 11:08:24 +0200 Subject: [PATCH] Fix: Small bugfix for creating templates Signed-off-by: Philipp Hempel --- lib/Controller/Api1Controller.php | 8 ++++---- lib/Db/ViewMapper.php | 2 +- lib/Service/PermissionsService.php | 4 ++-- lib/Service/ShareService.php | 2 +- lib/Service/TableService.php | 2 +- lib/Service/TableTemplateService.php | 3 --- lib/Service/ViewService.php | 2 +- 7 files changed, 10 insertions(+), 13 deletions(-) diff --git a/lib/Controller/Api1Controller.php b/lib/Controller/Api1Controller.php index 921798f60..78d4c849e 100644 --- a/lib/Controller/Api1Controller.php +++ b/lib/Controller/Api1Controller.php @@ -176,7 +176,7 @@ public function deleteView(int $viewId): DataResponse { } // Shares - + /** * @NoAdminRequired * @CORS @@ -465,7 +465,7 @@ public function deleteColumn(int $columnId): DataResponse { */ public function indexTableRowsSimple(int $tableId, ?int $limit, ?int $offset): DataResponse { return $this->handleError(function () use ($tableId, $limit, $offset) { - return $this->v1Api->getData($tableId, $limit, $offset, $this->userId,); + return $this->v1Api->getData($tableId, $limit, $offset, $this->userId); }); } @@ -538,7 +538,7 @@ public function deleteRow(int $rowId, int $viewId): DataResponse { return $this->rowService->delete($rowId, $viewId, $this->userId); }); } - + /** * @NoAdminRequired * @CORS @@ -551,7 +551,7 @@ public function createImport(int $viewId, string $path, bool $createMissingColum } // Api Function for backward compatibility - + /** * @NoAdminRequired * @CORS diff --git a/lib/Db/ViewMapper.php b/lib/Db/ViewMapper.php index 6a0b04276..2f7d3f6d0 100644 --- a/lib/Db/ViewMapper.php +++ b/lib/Db/ViewMapper.php @@ -148,7 +148,7 @@ public function search(string $term = null, ?string $userId = null, ?int $limit return $views; } - private function enhanceByOwnership(View &$view): void { + private function enhanceByOwnership(View $view): void { $view->setOwnership($this->tableMapper->findOwnership($view->getTableId())); $view->resetUpdatedFields(); } diff --git a/lib/Service/PermissionsService.php b/lib/Service/PermissionsService.php index 72d430f3b..08a01a3a1 100644 --- a/lib/Service/PermissionsService.php +++ b/lib/Service/PermissionsService.php @@ -201,7 +201,7 @@ public function canDeleteRowsByViewId(int $viewId, ?string $userId = null): bool */ public function canDeleteRowsByTableId(int $tableId, ?string $userId = null): bool { return $this->checkPermissionById($tableId, 'table', 'manage', $userId); - + } @@ -279,7 +279,7 @@ public function canDeleteShare(Share $item, ?string $userId = null): bool { public function getSharedPermissionsIfSharedWithMe(int $elementId, ?string $elementType = 'table', string $userId = null): array { try { - $shares = $this->shareMapper->findAllSharesForNodeFor($elementType, $elementId, $userId, 'user'); + $shares = $this->shareMapper->findAllSharesForNodeFor($elementType, $elementId, $userId); } catch (Exception $e) { $this->logger->warning('Exception occured: '.$e->getMessage().' Permission denied.'); return []; diff --git a/lib/Service/ShareService.php b/lib/Service/ShareService.php index a2e214b3a..ad0917426 100644 --- a/lib/Service/ShareService.php +++ b/lib/Service/ShareService.php @@ -290,7 +290,7 @@ public function delete(int $id): Share { * @return Share * @noinspection PhpUndefinedMethodInspection */ - private function addReceiverDisplayName(Share &$share):Share { + private function addReceiverDisplayName(Share $share):Share { if ($share->getReceiverType() === 'user') { $share->setReceiverDisplayName($this->userHelper->getUserDisplayName($share->getReceiver())); } elseif ($share->getReceiverType() === 'group') { diff --git a/lib/Service/TableService.php b/lib/Service/TableService.php index 3660e32ae..2f2e01131 100644 --- a/lib/Service/TableService.php +++ b/lib/Service/TableService.php @@ -128,7 +128,7 @@ public function findAll(?string $userId = null, bool $skipTableEnhancement = fal * * @noinspection PhpUndefinedMethodInspection */ - private function enhanceTable(Table &$table, string $userId): void { + private function enhanceTable(Table $table, string $userId): void { // add owner display name for UI $this->addOwnerDisplayName($table); diff --git a/lib/Service/TableTemplateService.php b/lib/Service/TableTemplateService.php index 087bc61aa..33e6fff47 100644 --- a/lib/Service/TableTemplateService.php +++ b/lib/Service/TableTemplateService.php @@ -776,9 +776,6 @@ private function createColumn(int $tableId, array $parameters, int $baseViewId): // userId $this->userId, - // tableId - $tableId, - // baseViewId $baseViewId, diff --git a/lib/Service/ViewService.php b/lib/Service/ViewService.php index 6496b3ef2..42d80051e 100644 --- a/lib/Service/ViewService.php +++ b/lib/Service/ViewService.php @@ -315,7 +315,7 @@ public function deleteByObject(View $view, ?string $userId = null): View { * * @noinspection PhpUndefinedMethodInspection */ - private function enhanceView(View &$view, string $userId): void { + private function enhanceView(View $view, string $userId): void { // add owner display name for UI $view->setOwnerDisplayName($this->userHelper->getUserDisplayName($view->getOwnership()));