Add canExportOCPPParams and canGenerateQrCode flags
MODIFY
src/authorization/AuthorizationsDefinition.ts
src/authorization/AuthorizationsDefinition.ts
@@ -81,7 +81,8 @@ const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
]
},
{ resource: Entity.SITE_AREA, action: [Action.CREATE, Action.UPDATE, Action.DELETE,
- Action.ASSIGN_ASSETS, Action.UNASSIGN_ASSETS, Action.ASSIGN_CHARGING_STATIONS, Action.UNASSIGN_CHARGING_STATIONS], attributes: ['*'] },
+ Action.ASSIGN_ASSETS, Action.UNASSIGN_ASSETS, Action.ASSIGN_CHARGING_STATIONS, Action.UNASSIGN_CHARGING_STATIONS,
+ Action.EXPORT_OCPP_PARAMS, Action.GENERATE_QR], attributes: ['*'] },
{
resource: Entity.CHARGING_STATIONS, action: [Action.LIST, Action.IN_ERROR],
attributes: [

MODIFY
src/server/rest/v1/service/AuthorizationService.ts
src/server/rest/v1/service/AuthorizationService.ts
@@ -564,9 +564,12 @@ export default class AuthorizationService {
const enhancedFilters: Record<string, any> = filteredRequest;
enhancedFilters.SiteAreaID = siteArea.id;
enhancedFilters.SiteID = siteArea.siteID;
- siteArea.canRead = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE_AREA, Action.READ, authorizationFilter, enhancedFilters);
- siteArea.canUpdate = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE_AREA, Action.DELETE, authorizationFilter, enhancedFilters);
- siteArea.canDelete = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE_AREA, Action.UPDATE, authorizationFilter, enhancedFilters);
+ siteArea.canRead = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE_AREA, Action.READ,
+ authorizationFilter, enhancedFilters);
+ siteArea.canUpdate = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE_AREA, Action.DELETE,
+ authorizationFilter, enhancedFilters);
+ siteArea.canDelete = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE_AREA, Action.UPDATE,
+ authorizationFilter, enhancedFilters);
siteArea.canAssignAssets = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE_AREA,
Action.ASSIGN_ASSETS, authorizationFilter, enhancedFilters);
siteArea.canUnassignAssets = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE_AREA,
@@ -575,6 +578,10 @@ export default class AuthorizationService {
Action.ASSIGN_CHARGING_STATIONS, authorizationFilter, enhancedFilters);
siteArea.canUnassignChargingStations = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE_AREA,
Action.UNASSIGN_CHARGING_STATIONS, authorizationFilter, enhancedFilters);
+ siteArea.canExportOCPPParams = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE_AREA,
+ Action.EXPORT_OCPP_PARAMS, authorizationFilter, enhancedFilters);
+ siteArea.canGenerateQrCode = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE_AREA,
+ Action.GENERATE_QR, authorizationFilter, enhancedFilters);
}
}

MODIFY
src/types/Authorization.ts
src/types/Authorization.ts
@@ -152,7 +152,9 @@ export enum Action {
ASSIGN_ASSETS = 'AssignAssets',
UNASSIGN_ASSETS = 'UnassignAssets',
ASSIGN_CHARGING_STATIONS = 'AssignChargingStations',
- UNASSIGN_CHARGING_STATIONS = 'UnassignChargingStations'
+ UNASSIGN_CHARGING_STATIONS = 'UnassignChargingStations',
+ EXPORT_OCPP_PARAMS = 'ExportOCPPParams',
+ GENERATE_QR = 'GenerateQRCode',
}
export interface AuthorizationContext {
@@ -183,6 +185,8 @@ export interface SiteAreaAuthorizationActions extends AuthorizationActions {
canUnassignAssets?: boolean;
canAssignChargingStations?: boolean;
canUnassignChargingStations?: boolean;
+ canExportOCPPParams?: boolean;
+ canGenerateQrCode?:boolean;
}
export interface SiteAuthorizationActions extends AuthorizationActions {

Add canExportOCPPParams and canGenerateQrCode flags