Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Correctly log failed attempts
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Jun 13, 2022
commit 6eb692da7fe73c899cb6a8d2aa045eddb1f14018
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,23 @@ public function addShare($shareWith, $name, $description, $providerId, $owner, $
$shareWith = $this->mapUid($shareWith);

if (!$this->userManager->userExists($shareWith)) {
return new JSONResponse(
$response = new JSONResponse(
['message' => 'User "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl()],
Http::STATUS_BAD_REQUEST
);
$response->throttle();
return $response;
}
}

if ($shareType === 'group') {
if (!$this->groupManager->groupExists($shareWith)) {
return new JSONResponse(
$response = new JSONResponse(
['message' => 'Group "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl()],
Http::STATUS_BAD_REQUEST
);
$response->throttle();
return $response;
}
}

Expand Down Expand Up @@ -253,10 +257,12 @@ public function receiveNotification($notificationType, $resourceType, $providerI
Http::STATUS_BAD_REQUEST
);
} catch (ShareNotFound $e) {
return new JSONResponse(
$response = new JSONResponse(
['message' => $e->getMessage()],
Http::STATUS_BAD_REQUEST
);
$response->throttle();
return $response;
} catch (ActionNotSupportedException $e) {
return new JSONResponse(
['message' => $e->getMessage()],
Expand All @@ -265,7 +271,9 @@ public function receiveNotification($notificationType, $resourceType, $providerI
} catch (BadRequestException $e) {
return new JSONResponse($e->getReturnMessage(), Http::STATUS_BAD_REQUEST);
} catch (AuthenticationFailedException $e) {
return new JSONResponse(["message" => "RESOURCE_NOT_FOUND"], Http::STATUS_FORBIDDEN);
$response = new JSONResponse(['message' => 'RESOURCE_NOT_FOUND'], Http::STATUS_FORBIDDEN);
$response->throttle();
return $response;
} catch (\Exception $e) {
return new JSONResponse(
['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()],
Expand Down