diff --git a/lib/Service/PermissionService.php b/lib/Service/PermissionService.php index bb66631e7..e573c0257 100644 --- a/lib/Service/PermissionService.php +++ b/lib/Service/PermissionService.php @@ -159,7 +159,6 @@ public function checkPermission(?IPermissionMapper $mapper, $id, int $permission $permissions = $this->getPermissions($boardId, $userId); if ($permissions[$permission] === true) { - if (!$allowDeletedCard && $mapper instanceof CardMapper) { $card = $mapper->find($id); if ($card->getDeletedAt() > 0) { diff --git a/tests/integration/features/bootstrap/BoardContext.php b/tests/integration/features/bootstrap/BoardContext.php index 09d05fa30..45038de64 100644 --- a/tests/integration/features/bootstrap/BoardContext.php +++ b/tests/integration/features/bootstrap/BoardContext.php @@ -320,6 +320,4 @@ public function getActivitiesForTheLastCard() { public function theFetchedActivitiesShouldHaveEntries($count) { Assert::assertEquals($count, count($this->activities ?? [])); } - - } diff --git a/tests/integration/features/bootstrap/CommentContext.php b/tests/integration/features/bootstrap/CommentContext.php index 92bc9a347..aba5a6065 100644 --- a/tests/integration/features/bootstrap/CommentContext.php +++ b/tests/integration/features/bootstrap/CommentContext.php @@ -58,5 +58,4 @@ public function deleteTheCommentOnTheCard() { $card = $this->boardContext->getLastUsedCard(); $this->requestContext->sendOCSRequest('DELETE', '/apps/deck/api/v1.0/cards/' . $card['id'] . '/comments/'. $this->lastComment['id']); } - } diff --git a/tests/integration/features/bootstrap/RequestContext.php b/tests/integration/features/bootstrap/RequestContext.php index 9df6be205..ebf01e80a 100644 --- a/tests/integration/features/bootstrap/RequestContext.php +++ b/tests/integration/features/bootstrap/RequestContext.php @@ -166,4 +166,29 @@ public function getResponseBodyFromJson() { $this->getResponse()->getBody()->seek(0); return json_decode((string)$this->getResponse()->getBody(), true); } + + /** + * @Given /^the response should be a list of objects$/ + */ + public function theResponseShouldBeAListOfObjects() { + $jsonResponse = $this->getResponseBodyFromJson(); + Assert::assertEquals(array_keys($jsonResponse), range(0, count($jsonResponse) - 1)); + } + + /** + * @When /^the response should contain an element with the properties$/ + */ + public function responseContainsElement(TableNode $element) { + $json = $this->getResponseBodyFromJson(); + $found = array_filter($json, function ($board) use ($element) { + foreach ($element as $row) { + if ($row['value'] !== $board[$row['property']]) { + return false; + } + } + + return true; + }); + Assert::assertEquals(1, count($found)); + } }