From ec54600d41e798a66e61e6311ee07cccfb1aea2b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 2 Aug 2023 01:47:42 +0200 Subject: [PATCH] refactor: cleanup RFID authorization code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ocpp/OCPPServiceUtils.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index b7474087..f5bbe160 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -232,7 +232,6 @@ export class OCPPServiceUtils { `${chargingStation.logPrefix()} The charging station expects to authorize RFID tags but nor local authorization nor remote authorization are enabled. Misbehavior may occur`, ); } - let authorized = false; if ( chargingStation.getLocalAuthListEnabled() === true && OCPPServiceUtils.isIdTagLocalAuthorized(chargingStation, idTag) @@ -240,15 +239,11 @@ export class OCPPServiceUtils { const connectorStatus: ConnectorStatus = chargingStation.getConnectorStatus(connectorId)!; connectorStatus.localAuthorizeIdTag = idTag; connectorStatus.idTagLocalAuthorized = true; - authorized = true; + return true; } else if (chargingStation.getRemoteAuthorization()) { - authorized = await OCPPServiceUtils.isIdTagRemoteAuthorized( - chargingStation, - connectorId, - idTag, - ); + return await OCPPServiceUtils.isIdTagRemoteAuthorized(chargingStation, connectorId, idTag); } - return authorized; + return false; } protected static checkConnectorStatusTransition( -- 2.34.1