diff --git a/lib/Db/AclMapper.php b/lib/Db/AclMapper.php index e0ed3c838..732fb54f8 100644 --- a/lib/Db/AclMapper.php +++ b/lib/Db/AclMapper.php @@ -35,19 +35,19 @@ class AclMapper extends DeckMapper implements IPermissionMapper { return $this->findEntities($sql, [$boardId], $limit, $offset); } - public function isOwner($userId, $aclId) { + public function isOwner($userId, $aclId): bool { $sql = 'SELECT owner FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_board_acl` WHERE id = ?)'; $stmt = $this->execute($sql, [$aclId]); $row = $stmt->fetch(); return ($row['owner'] === $userId); } - public function findBoardId($aclId) { + public function findBoardId($aclId): ?int { $entity = $this->find($aclId); return $entity->getBoardId(); } - public function findByParticipant($type, $participant) { + public function findByParticipant($type, $participant): array { $sql = 'SELECT * from *PREFIX*deck_board_acl WHERE type = ? AND participant = ?'; return $this->findEntities($sql, [$type, $participant]); } diff --git a/lib/Db/AssignmentMapper.php b/lib/Db/AssignmentMapper.php index 0491cff1e..85a9cf197 100644 --- a/lib/Db/AssignmentMapper.php +++ b/lib/Db/AssignmentMapper.php @@ -79,11 +79,11 @@ class AssignmentMapper extends QBMapper implements IPermissionMapper { } - public function isOwner($userId, $cardId) { + public function isOwner($userId, $cardId): bool { return $this->cardMapper->isOwner($userId, $cardId); } - public function findBoardId($cardId) { + public function findBoardId($cardId): ?int { return $this->cardMapper->findBoardId($cardId); } diff --git a/lib/Db/AttachmentMapper.php b/lib/Db/AttachmentMapper.php index 69681b0c1..46e63f7c4 100644 --- a/lib/Db/AttachmentMapper.php +++ b/lib/Db/AttachmentMapper.php @@ -156,7 +156,7 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper { * @param $id int|string unique entity identifier * @return boolean */ - public function isOwner($userId, $id) { + public function isOwner($userId, $id): bool { try { $attachment = $this->find($id); return $this->cardMapper->isOwner($userId, $attachment->getCardId()); @@ -172,7 +172,7 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper { * @param $id int|string unique entity identifier * @return int|null id of Board */ - public function findBoardId($id) { + public function findBoardId($id): ?int { try { $attachment = $this->find($id); } catch (\Exception $e) { diff --git a/lib/Db/BoardMapper.php b/lib/Db/BoardMapper.php index 72ac5b4ec..1ef690b8c 100644 --- a/lib/Db/BoardMapper.php +++ b/lib/Db/BoardMapper.php @@ -220,12 +220,12 @@ class BoardMapper extends DeckMapper implements IPermissionMapper { return parent::delete($entity); } - public function isOwner($userId, $boardId) { + public function isOwner($userId, $boardId): bool { $board = $this->find($boardId); return ($board->getOwner() === $userId); } - public function findBoardId($id) { + public function findBoardId($id): ?int { return $id; } diff --git a/lib/Db/CardMapper.php b/lib/Db/CardMapper.php index c8d8f4d2a..7bcf65741 100644 --- a/lib/Db/CardMapper.php +++ b/lib/Db/CardMapper.php @@ -308,7 +308,7 @@ class CardMapper extends QBMapper implements IPermissionMapper { $qb->execute(); } - public function isOwner($userId, $cardId) { + public function isOwner($userId, $cardId): bool { $sql = 'SELECT owner FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_stacks` WHERE id IN (SELECT stack_id FROM `*PREFIX*deck_cards` WHERE id = ?))'; $stmt = $this->db->prepare($sql); $stmt->bindParam(1, $cardId, \PDO::PARAM_INT); @@ -317,7 +317,7 @@ class CardMapper extends QBMapper implements IPermissionMapper { return ($row['owner'] === $userId); } - public function findBoardId($cardId) { + public function findBoardId($cardId): ?int { $sql = 'SELECT id FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_stacks` WHERE id IN (SELECT stack_id FROM `*PREFIX*deck_cards` WHERE id = ?))'; $stmt = $this->db->prepare($sql); $stmt->bindParam(1, $cardId, \PDO::PARAM_INT); diff --git a/lib/Db/IPermissionMapper.php b/lib/Db/IPermissionMapper.php index 2b94405b8..39a900253 100644 --- a/lib/Db/IPermissionMapper.php +++ b/lib/Db/IPermissionMapper.php @@ -33,7 +33,7 @@ interface IPermissionMapper { * @param $id int|string unique entity identifier * @return boolean */ - public function isOwner($userId, $id); + public function isOwner($userId, $id): bool; /** * Query boardId for Entity of given $id @@ -41,5 +41,5 @@ interface IPermissionMapper { * @param $id int|string unique entity identifier * @return int|null id of Board */ - public function findBoardId($id); + public function findBoardId($id): ?int; } diff --git a/lib/Db/LabelMapper.php b/lib/Db/LabelMapper.php index ec0b279a0..26f89bf3a 100644 --- a/lib/Db/LabelMapper.php +++ b/lib/Db/LabelMapper.php @@ -92,14 +92,14 @@ class LabelMapper extends DeckMapper implements IPermissionMapper { $stmt->execute(); } - public function isOwner($userId, $labelId) { + public function isOwner($userId, $labelId): bool { $sql = 'SELECT owner FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_labels` WHERE id = ?)'; $stmt = $this->execute($sql, [$labelId]); $row = $stmt->fetch(); return ($row['owner'] === $userId); } - public function findBoardId($labelId) { + public function findBoardId($labelId): ?int { $entity = $this->find($labelId); return $entity->getBoardId(); } diff --git a/lib/Db/StackMapper.php b/lib/Db/StackMapper.php index 58b343929..88cffeeba 100644 --- a/lib/Db/StackMapper.php +++ b/lib/Db/StackMapper.php @@ -67,14 +67,14 @@ class StackMapper extends DeckMapper implements IPermissionMapper { return parent::delete($entity); } - public function isOwner($userId, $stackId) { + public function isOwner($userId, $stackId): bool { $sql = 'SELECT owner FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_stacks` WHERE id = ?)'; $stmt = $this->execute($sql, [$stackId]); $row = $stmt->fetch(); return ($row['owner'] === $userId); } - public function findBoardId($stackId) { + public function findBoardId($stackId): ?int { $entity = $this->find($stackId); return $entity->getBoardId(); }