only current organization user can use remote start transaction
MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -373,7 +373,8 @@ export default class ChargingStationService {
connectorID: filteredRequest.ConnectorID,
withChargingStation: filteredRequest.WithChargingStation,
withSiteArea: true,
- siteIDs: Authorizations.getAuthorizedSiteIDs(req.user, filteredRequest.SiteID ? filteredRequest.SiteID.split('|') : null), },
+ siteIDs: Authorizations.getAuthorizedSiteIDs(req.user, filteredRequest.SiteID ? filteredRequest.SiteID.split('|') : null),
+ },
{ limit: filteredRequest.Limit, skip: filteredRequest.Skip, sort: filteredRequest.Sort, onlyRecordCount: filteredRequest.OnlyRecordCount },
[
'id', 'chargingStationID', 'chargePointID', 'connectorID', 'chargingStation.id',
@@ -1008,6 +1009,16 @@ export default class ChargingStationService {
// Check if user is authorized
const user = await Authorizations.isAuthorizedToStartTransaction(req.user.tenantID, chargingStation, filteredRequest.args.tagID,
ServerAction.CHARGING_STATION_REMOTE_START_TRANSACTION, Action.REMOTE_START_TRANSACTION);
+ if (!user.issuer) {
+ throw new AppError({
+ source: Constants.CENTRAL_SERVER,
+ errorCode: HTTPError.GENERAL_ERROR,
+ message: `User not issued by the organization execute command '${Command.REMOTE_START_TRANSACTION}'`,
+ module: MODULE_NAME, method: 'handleAction',
+ user: req.user,
+ action: action
+ });
+ }
// Ok: Execute it
result = await this.handleChargingStationCommand(
req.user.tenantID, req.user, chargingStation, action, command, filteredRequest.args);

MODIFY
src/server/rest/v1/service/UserService.ts
src/server/rest/v1/service/UserService.ts
@@ -1071,14 +1071,16 @@ export default class UserService {
let tagsMDB = await UserStorage.getTags(req.user.tenantID, {
userIDs: [userID],
defaultTag: true,
- active: true
+ active: true,
+ issuer: true
}, Constants.DB_PARAMS_SINGLE_RECORD, [
'id', 'userID', 'active', 'ocpiToken', 'description', 'issuer', 'default'
]);
if (tagsMDB.count < 1) {
tagsMDB = await UserStorage.getTags(req.user.tenantID, {
userIDs: [userID],
- active: true
+ active: true,
+ issuer: true
}, Constants.DB_PARAMS_SINGLE_RECORD, [
'id', 'userID', 'active', 'ocpiToken', 'description', 'issuer', 'default'
]);

only current organization user can use remote start transaction