Add canExportOCPPParams and canGenerateQrCode flags.
MODIFY
src/authorization/AuthorizationsDefinition.ts
src/authorization/AuthorizationsDefinition.ts
@@ -67,7 +67,7 @@ const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
'autoUserSiteAssignment', 'distanceMeters', 'public', 'createdOn', 'lastChangedOn'
]
},
- { resource: Entity.SITE, action: [Action.CREATE, Action.UPDATE, Action.DELETE], attributes: ['*'] },
+ { resource: Entity.SITE, action: [Action.CREATE, Action.UPDATE, Action.DELETE, Action.EXPORT_OCPP_PARAMS, Action.GENERATE_QR], attributes: ['*'] },
{ resource: Entity.SITE_AREAS, action: Action.LIST, attributes: ['*'] },
{ resource: Entity.SITE_AREA, action: [Action.CREATE, Action.READ, Action.UPDATE, Action.DELETE], 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
@@ -90,6 +90,10 @@ export default class AuthorizationService {
authorizationFilter, filteredRequest);
site.canUpdate = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE, Action.UPDATE,
authorizationFilter, filteredRequest);
+ site.canGenerateQrCode = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE, Action.GENERATE_QR,
+ authorizationFilter, filteredRequest);
+ site.canExportOCPPParams = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE, Action.EXPORT_OCPP_PARAMS,
+ authorizationFilter, filteredRequest);
site.canAssignUsers = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.USERS_SITES, Action.ASSIGN,
authorizationFilter, filteredRequest);
site.canUnassignUsers = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.USERS_SITES, Action.UNASSIGN,

MODIFY
src/types/Authorization.ts
src/types/Authorization.ts
@@ -148,7 +148,9 @@ export enum Action {
REGISTER = 'Register',
TRIGGER_JOB = 'TriggerJob',
DOWNLOAD = 'Download',
- IMPORT = 'Import'
+ IMPORT = 'Import',
+ EXPORT_OCPP_PARAMS = 'ExportOCPPParams',
+ GENERATE_QR = 'GenerateQRCode'
}
export interface AuthorizationContext {
@@ -178,6 +180,8 @@ export interface AuthorizationActions {
export interface SiteAuthorizationActions extends AuthorizationActions {
canAssignUsers?: boolean;
canUnassignUsers?: boolean;
+ canExportOCPPParams?: boolean;
+ canGenerateQrCode?: boolean;
}
export enum DynamicAuthorizationFilterName {

Add canExportOCPPParams and canGenerateQrCode flags.