pricing - auth - canMaintainPricingDefinitions
MODIFY
src/authorization/AuthorizationsDefinition.ts
src/authorization/AuthorizationsDefinition.ts
@@ -198,7 +198,7 @@ export const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
{
resource: Entity.SITE,
action: [
- Action.CREATE, Action.UPDATE, Action.DELETE, Action.EXPORT_OCPP_PARAMS, Action.GENERATE_QR
+ Action.CREATE, Action.UPDATE, Action.DELETE, Action.EXPORT_OCPP_PARAMS, Action.GENERATE_QR, Action.MAINTAIN_PRICING_DEFINITIONS,
],
condition: {
Fn: 'custom:dynamicAuthorizations',
@@ -979,7 +979,7 @@ export const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
]
},
{
- resource: Entity.SITE, action: [Action.UPDATE],
+ resource: Entity.SITE, action: [Action.UPDATE, Action.MAINTAIN_PRICING_DEFINITIONS],
condition: {
Fn: 'custom:dynamicAuthorizations',
args: {

MODIFY
src/server/rest/v1/service/AuthorizationService.ts
src/server/rest/v1/service/AuthorizationService.ts
@@ -93,6 +93,8 @@ export default class AuthorizationService {
tenant, userToken, Entity.SITE, Action.DELETE, authorizationFilter, { SiteID: site.id }, site);
site.canUpdate = await AuthorizationService.canPerformAuthorizationAction(
tenant, userToken, Entity.SITE, Action.UPDATE, authorizationFilter, { SiteID: site.id }, site);
+ site.canMaintainPricingDefinitions = await AuthorizationService.canPerformAuthorizationAction(
+ tenant, userToken, Entity.SITE, Action.MAINTAIN_PRICING_DEFINITIONS, authorizationFilter, { SiteID: site.id }, site);
site.canExportOCPPParams = await AuthorizationService.canPerformAuthorizationAction(
tenant, userToken, Entity.SITE_AREA, Action.EXPORT_OCPP_PARAMS, authorizationFilter, { SiteID: site.id }, site);
site.canGenerateQrCode = await AuthorizationService.canPerformAuthorizationAction(

MODIFY
src/types/Authorization.ts
src/types/Authorization.ts
@@ -154,6 +154,7 @@ export enum Action {
READ_CHARGING_STATIONS_FROM_SITE_AREA = 'ReadChargingStationsFromSiteArea',
EXPORT_OCPP_PARAMS = 'ExportOCPPParams',
GENERATE_QR = 'GenerateQrCode',
+ MAINTAIN_PRICING_DEFINITIONS = 'MaintainPricingDefinitions',
}
export interface AuthorizationContext {
@@ -208,6 +209,7 @@ export interface SiteAuthorizationActions extends AuthorizationActions {
canReadUsers?: boolean;
canExportOCPPParams?: boolean;
canGenerateQrCode?: boolean;
+ canMaintainPricingDefinitions?: boolean;
}
export enum DynamicAuthorizationFilterName {

pricing - auth - canMaintainPricingDefinitions