From 07807ea67c6f656f9e3ebf4cbf71356a06adacc5 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Thu, 29 Feb 2024 16:00:11 -0300 Subject: [PATCH 1/2] Make the endpoint to delete pfx acessible by non admin Signed-off-by: Vitor Mattos --- lib/Controller/AccountController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 779219f24c..093ea2bf99 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -478,6 +478,7 @@ public function updateSettings(?string $phone = null): JSONResponse { ); } + #[NoAdminRequired] public function deletePfx(): JSONResponse { $this->accountService->deletePfx($this->userSession->getUser()); return new JSONResponse( From abc898bbb1e8d9fac6ae6c0e440027ebb1ea4df3 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Thu, 29 Feb 2024 16:00:45 -0300 Subject: [PATCH 2/2] Fix clean entity Signed-off-by: Vitor Mattos --- lib/Helper/ValidateHelper.php | 4 +++- lib/Service/IdentifyMethodService.php | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/Helper/ValidateHelper.php b/lib/Helper/ValidateHelper.php index 1d12a8a98a..7e535bf9cc 100644 --- a/lib/Helper/ValidateHelper.php +++ b/lib/Helper/ValidateHelper.php @@ -732,7 +732,9 @@ public function validateCredentials(SignRequest $signRequest, ?IUser $user, stri } } if (empty($identifyMethods)) { - $identifyMethod = $this->identifyMethodService->getInstanceOfIdentifyMethod($identifyMethodName, $identifyValue); + $identifyMethod = $this->identifyMethodService + ->setCurrentIdentifyMethod() + ->getInstanceOfIdentifyMethod($identifyMethodName, $identifyValue); } else { $identifyMethod = current($identifyMethods); } diff --git a/lib/Service/IdentifyMethodService.php b/lib/Service/IdentifyMethodService.php index 83210dc734..baf9ff30e3 100644 --- a/lib/Service/IdentifyMethodService.php +++ b/lib/Service/IdentifyMethodService.php @@ -142,19 +142,24 @@ private function isMandatoryMethod(string $methodName): bool { public function getByUserData(array $data) { $return = []; foreach ($data as $method => $identifyValue) { - $this->currentIdentifyMethod = null; + $this->setCurrentIdentifyMethod(); $return[] = $this->getInstanceOfIdentifyMethod($method, $identifyValue); } return $return; } + public function setCurrentIdentifyMethod(?IdentifyMethod $entity = null): self { + $this->currentIdentifyMethod = $entity; + return $this; + } + /** * @return array> */ public function getIdentifyMethodsFromSignRequestId(int $signRequestId): array { $entities = $this->identifyMethodMapper->getIdentifyMethodsFromSignRequestId($signRequestId); foreach ($entities as $entity) { - $this->currentIdentifyMethod = $entity; + $this->setCurrentIdentifyMethod($entity); $this->getInstanceOfIdentifyMethod( $entity->getIdentifierKey(), $entity->getIdentifierValue(),