use of forbidden instead of bad_request
MODIFY
src/server/rest/v1/service/RegistrationTokenService.ts
src/server/rest/v1/service/RegistrationTokenService.ts
@@ -60,12 +60,11 @@ export default class RegistrationTokenService {
}
// Check site is provided for site admins
if (Authorizations.isSiteAdmin(req.user) && !filteredRequest.siteAreaID) {
- throw new AppError({
- source: Constants.CENTRAL_SERVER,
- errorCode: HTTPError.BAD_REQUEST,
- message: 'The site must be provided',
+ throw new AppAuthError({
+ errorCode: HTTPAuthError.FORBIDDEN,
+ user: req.user,
+ action: Action.CREATE, entity: Entity.TOKEN,
module: MODULE_NAME, method: 'handleCreateRegistrationToken',
- user: req.user
});
}
// Create

MODIFY
src/types/HTTPError.ts
src/types/HTTPError.ts
@@ -60,8 +60,6 @@ export enum HTTPError {
CANNOT_ACQUIRE_LOCK = 510,
INVALID_FILE_FORMAT = 583,
-
- BAD_REQUEST = 400,
}
export enum HTTPAuthError {

use of forbidden instead of bad_request