Fixed user Basic cannot read his own data in Transaction
MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -492,10 +492,10 @@ export default class OCPPService {
// Get Transaction
const transaction = await this.getTransactionFromStopTransaction(tenant, chargingStation, headers, stopTransaction);
// Get Tag ID that stopped the Transaction
- const tagId = this.getStopTransactionTagId(stopTransaction, transaction);
+ const tagID = this.getStopTransactionTagId(stopTransaction, transaction);
// Transaction is stopped by central system?
const { user, alternateUser } = await this.checkAuthorizeStopTransactionAndGetUsers(
- tenant, chargingStation, transaction, tagId, isStoppedByCentralSystem);
+ tenant, chargingStation, transaction, tagID, isStoppedByCentralSystem);
// Free the connector
OCPPUtils.checkAndFreeChargingStationConnector(chargingStation, transaction.connectorId);
// Save Charging Station
@@ -505,7 +505,7 @@ export default class OCPPService {
// Transaction End has already been received?
await this.checkAndApplyLastConsumptionInStopTransaction(tenant, chargingStation, transaction, stopTransaction);
// Update Transaction with Stop Transaction and Stop MeterValues
- OCPPUtils.updateTransactionWithStopTransaction(transaction, stopTransaction, user, alternateUser, tagId);
+ OCPPUtils.updateTransactionWithStopTransaction(transaction, stopTransaction, user, alternateUser, tagID);
// Bill
await OCPPUtils.processTransactionBilling(tenant.id, transaction, TransactionAction.STOP);
// Roaming

MODIFY
src/server/rest/v1/service/TransactionService.ts
src/server/rest/v1/service/TransactionService.ts
@@ -646,7 +646,7 @@ export default class TransactionService {
});
}
// Check User
- if (!(await Authorizations.canReadUser(req.user)).authorized) {
+ if (!(await Authorizations.canReadUser(req.user, { UserID: transaction.userID })).authorized) {
// Remove User
delete transaction.user;
delete transaction.userID;

Fixed user Basic cannot read his own data in Transaction