Do not authorize roaming tags on a private charging station
MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -481,7 +481,7 @@ export default class OCPPService {
message: `Unable to authorize user '${user.id}' not issued locally`
});
}
- // Get tag
+ // GetTag
const tag = await TagStorage.getTag(headers.tenantID, authorize.idTag);
if (!tag) {
throw new BackendError({
@@ -499,6 +499,15 @@ export default class OCPPService {
message: `Tag ID '${authorize.idTag}' cannot be authorized thought OCPI protocol due to missing OCPI Token`
});
}
+ // Check Charging Station
+ if (!chargingStation.public) {
+ throw new BackendError({
+ user: user,
+ action: ServerAction.AUTHORIZE,
+ module: MODULE_NAME, method: 'handleAuthorize',
+ message: `Tag ID '${authorize.idTag}' cannot be authorized on a private charging station`
+ });
+ }
const ocpiClient = await OCPIClientFactory.getAvailableOcpiClient(tenant, OCPIRole.CPO) as CpoOCPIClient;
if (!ocpiClient) {
throw new BackendError({
@@ -542,7 +551,8 @@ export default class OCPPService {
}
}
- public async handleDiagnosticsStatusNotification(headers: OCPPHeader, diagnosticsStatusNotification: OCPPDiagnosticsStatusNotificationRequestExtended): Promise<OCPPDiagnosticsStatusNotificationResponse> {
+ public async handleDiagnosticsStatusNotification(headers: OCPPHeader,
+ diagnosticsStatusNotification: OCPPDiagnosticsStatusNotificationRequestExtended): Promise<OCPPDiagnosticsStatusNotificationResponse> {
try {
// Get the charging station
const chargingStation = await OCPPUtils.checkAndGetChargingStation(headers.chargeBoxIdentity, headers.tenantID);

Do not authorize roaming tags on a private charging station