changed filterRegistrationTokenRequest to filterRegistrationTokenByIDRequest
MODIFY
src/server/rest/v1/service/RegistrationTokenService.ts
src/server/rest/v1/service/RegistrationTokenService.ts
@@ -263,7 +263,7 @@ export default class RegistrationTokenService {
module: MODULE_NAME, method: 'handleGetRegistrationToken'
});
}
- const filteredRequest = RegistrationTokenSecurity.filterRegistrationTokenRequest(req.query);
+ const filteredRequestId = RegistrationTokenSecurity.filterRegistrationTokenByIDRequest(req.query);
// Check User
let userProject: string[] = [];
if (Authorizations.canListUsers(req.user)) {
@@ -271,13 +271,13 @@ export default class RegistrationTokenService {
}
// Get the token
const registrationToken = await RegistrationTokenStorage.getRegistrationToken(req.user.tenantID,
- filteredRequest.id,
+ filteredRequestId,
[
'id', 'status', 'description', 'createdOn', 'lastChangedOn', 'expirationDate', 'revocationDate',
'siteAreaID', 'siteArea.name',
...userProject
]);
- UtilsService.assertObjectExists(action, registrationToken, `Token with ID '${filteredRequest.id}' does not exist`,
+ UtilsService.assertObjectExists(action, registrationToken, `Token with ID '${filteredRequestId}' does not exist`,
MODULE_NAME, 'handleGetRegistrationToken', req.user);
// Build OCPP URLs
registrationToken.ocpp15SOAPUrl = Utils.buildOCPPServerURL(req.user.tenantID, OCPPVersion.VERSION_15, OCPPProtocol.SOAP, registrationToken.id);

MODIFY
src/server/rest/v1/service/security/RegistrationTokenSecurity.ts
src/server/rest/v1/service/security/RegistrationTokenSecurity.ts
@@ -21,15 +21,6 @@ export default class RegistrationTokenSecurity {
};
}
- public static filterRegistrationTokenRequest(request: any): Partial<RegistrationToken> {
- return {
- id: sanitize(request.ID),
- description: sanitize(request.description),
- siteAreaID: sanitize(request.siteAreaID),
- expirationDate: sanitize(request.expirationDate)
- };
- }
-
public static filterRegistrationTokenByIDRequest(request: any): string {
return sanitize(request.ID);
}

changed filterRegistrationTokenRequest to filterRegistrationTokenByIDRequest