Fixed user with role Demo can see the user in session's details pop-up
MODIFY
src/server/rest/v1/service/TransactionService.ts
src/server/rest/v1/service/TransactionService.ts
@@ -522,11 +522,9 @@ export default class TransactionService {
'handleGetConsumptionFromTransaction', req.user);
let projectFields = [
'id', 'chargeBoxID', 'timestamp', 'issuer', 'stateOfCharge', 'timezone', 'connectorId', 'meterStart', 'siteAreaID', 'siteID',
- 'userID', 'user.id', 'user.name', 'user.firstName', 'user.email', 'tagID', 'currentTotalDurationSecs', 'currentTotalInactivitySecs',
- 'currentInstantWatts', 'currentTotalConsumptionWh', 'currentStateOfCharge', 'currentInactivityStatus',
+ 'currentTotalDurationSecs', 'currentTotalInactivitySecs', 'currentInstantWatts', 'currentTotalConsumptionWh', 'currentStateOfCharge', 'currentInactivityStatus',
'stop.roundedPrice', 'stop.price', 'stop.priceUnit', 'stop.inactivityStatus', 'stop.stateOfCharge', 'stop.timestamp', 'stop.totalConsumptionWh',
'stop.totalDurationSecs', 'stop.totalInactivitySecs', 'stop.extraInactivitySecs', 'stop.pricingSource',
- 'stop.userID', 'stop.user.id', 'stop.user.name', 'stop.user.firstName', 'stop.user.email', 'stop.tagID',
];
// Check Cars
if (Utils.isComponentActiveFromToken(req.user, TenantComponents.CAR)) {
@@ -544,6 +542,13 @@ export default class TransactionService {
];
}
}
+ if (await Authorizations.canListUsers(req.user)) {
+ projectFields = [
+ ...projectFields,
+ 'userID', 'user.id', 'user.name', 'user.firstName', 'user.email', 'tagID',
+ 'stop.userID', 'stop.user.id', 'stop.user.name', 'stop.user.firstName', 'stop.user.email', 'stop.tagID'
+ ];
+ }
// Get Transaction
const transaction = await TransactionStorage.getTransaction(req.user.tenantID, filteredRequest.TransactionId, projectFields);
UtilsService.assertObjectExists(action, transaction, `Transaction ID '${filteredRequest.TransactionId}' does not exist`,

Fixed user with role Demo can see the user in session's details pop-up