Move jsonError out of Factory\Api\Mastodon\Error->Forbidden

This commit is contained in:
Hypolite Petovan 2023-10-11 09:31:02 -04:00
parent 6a2ca1a6b6
commit 696c56b6be
2 changed files with 5 additions and 8 deletions

View file

@ -424,17 +424,17 @@ class BaseApi extends BaseModule
if (empty($token)) {
$this->logger->notice('Empty application token');
DI::mstdnError()->Forbidden();
$this->logErrorAndJsonExit(403, $this->errorFactory->Forbidden());
}
if (!isset($token[$scope])) {
$this->logger->warning('The requested scope does not exist', ['scope' => $scope, 'application' => $token]);
DI::mstdnError()->Forbidden();
$this->logErrorAndJsonExit(403, $this->errorFactory->Forbidden());
}
if (empty($token[$scope])) {
$this->logger->warning('The requested scope is not allowed', ['scope' => $scope, 'application' => $token]);
DI::mstdnError()->Forbidden();
$this->logErrorAndJsonExit(403, $this->errorFactory->Forbidden());
}
}