diff --git a/lib/Controller/FileController.php b/lib/Controller/FileController.php index 49198e0b71..598cbb7577 100644 --- a/lib/Controller/FileController.php +++ b/lib/Controller/FileController.php @@ -155,10 +155,10 @@ public function validate(?string $type = null, $identifier = null): JSONResponse #[NoAdminRequired] #[NoCSRFRequired] - public function list($page = null, $length = null): JSONResponse { + public function list($page = null, $length = null, ?array $filter = []): JSONResponse { $return = $this->fileService ->setMe($this->userSession->getUser()) - ->listAssociatedFilesOfSignFlow($page, $length); + ->listAssociatedFilesOfSignFlow($page, $length, $filter); return new JSONResponse($return, Http::STATUS_OK); } diff --git a/lib/Db/SignRequestMapper.php b/lib/Db/SignRequestMapper.php index 258d7cc2a5..0f8fa5492a 100644 --- a/lib/Db/SignRequestMapper.php +++ b/lib/Db/SignRequestMapper.php @@ -352,9 +352,10 @@ public function getByFileIdAndSignRequestId(int $fileId, int $signRequestId): Si public function getFilesAssociatedFilesWithMeFormatted( IUser $user, int $page = null, - int $length = null + int $length = null, + array $filter, ): array { - $pagination = $this->getFilesAssociatedFilesWithMeStmt($user->getUID(), $user->getEMailAddress()); + $pagination = $this->getFilesAssociatedFilesWithMeStmt($user->getUID(), $user->getEMailAddress(), $filter); $pagination->setMaxPerPage($length); $pagination->setCurrentPage($page); $currentPageResults = $pagination->getCurrentPageResults(); @@ -488,6 +489,11 @@ private function getFilesAssociatedFilesWithMeQueryBuilder(string $userId, ?stri } $qb->where($qb->expr()->orX(...$or)); if ($filter) { + if (isset($filter['signer_uuid'])) { + $qb->andWhere( + $qb->expr()->eq('sr.uuid', $qb->createNamedParameter($filter['signer_uuid'])) + ); + } if (isset($filter['nodeId'])) { $qb->andWhere( $qb->expr()->eq('f.node_id', $qb->createNamedParameter($filter['nodeId'], IQueryBuilder::PARAM_INT))