try for authorizations
spoiler : does not work -> siteadmin cancreate where she's not admin !!?
MODIFY
src/authorization/AuthorizationsDefinition.ts
src/authorization/AuthorizationsDefinition.ts
@@ -380,22 +380,6 @@ export const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
},
basic: {
grants: [
- { resource: Entity.PRICING_DEFINITION, action: [Action.LIST],
- condition: {
- Fn: 'custom:dynamicAuthorizations',
- args: {
- asserts: [],
- filters: ['AssignedSites']
- }
- },
- attributes: ['id', 'entityID', 'entityType', 'name', 'description', 'entityName',
- 'staticRestrictions.validFrom', 'staticRestrictions.validTo', 'staticRestrictions.connectorType', 'staticRestrictions.connectorPowerkW',
- 'restrictions.minEnergyKWh', 'restrictions.maxEnergyKWh', 'restrictions.minDurationSecs', 'restrictions.maxDurationSecs',
- 'dimensions.flatFee.active', 'dimensions.flatFee.price', 'dimensions.flatFee.stepSize', 'dimensions.flatFee.pricedData',
- 'dimensions.energy.active', 'dimensions.energy.price', 'dimensions.energy.stepSize', 'dimensions.energy.pricedData',
- 'dimensions.chargingTime.active', 'dimensions.chargingTime.price', 'dimensions.chargingTime.stepSize', 'dimensions.chargingTime.pricedData',
- 'dimensions.parkingTime.active', 'dimensions.parkingTime.price', 'dimensions.parkingTime.stepSize', 'dimensions.parkingTime.pricedData',]
- },
{
resource: Entity.USER, action: [Action.READ, Action.UPDATE],
condition: {
@@ -1202,6 +1186,56 @@ export const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
}
}
},
+ // { resource: Entity.PRICING_DEFINITION, action: [Action.LIST],
+ // condition: {
+ // Fn: 'custom:dynamicAuthorizations',
+ // args: {
+ // asserts: [],
+ // filters: ['AssignedSites']
+ // }
+ // },
+ // attributes: ['id', 'entityID', 'entityType', 'name', 'description', 'entityName',
+ // 'staticRestrictions.validFrom', 'staticRestrictions.validTo', 'staticRestrictions.connectorType', 'staticRestrictions.connectorPowerkW',
+ // 'restrictions.minEnergyKWh', 'restrictions.maxEnergyKWh', 'restrictions.minDurationSecs', 'restrictions.maxDurationSecs',
+ // 'dimensions.flatFee.active', 'dimensions.flatFee.price', 'dimensions.flatFee.stepSize', 'dimensions.flatFee.pricedData',
+ // 'dimensions.energy.active', 'dimensions.energy.price', 'dimensions.energy.stepSize', 'dimensions.energy.pricedData',
+ // 'dimensions.chargingTime.active', 'dimensions.chargingTime.price', 'dimensions.chargingTime.stepSize', 'dimensions.chargingTime.pricedData',
+ // 'dimensions.parkingTime.active', 'dimensions.parkingTime.price', 'dimensions.parkingTime.stepSize', 'dimensions.parkingTime.pricedData',]
+ // },
+ { resource: Entity.PRICING_DEFINITION, action: [Action.LIST],
+ attributes: ['id', 'entityID', 'entityType', 'name', 'description', 'entityName',
+ 'staticRestrictions.validFrom', 'staticRestrictions.validTo', 'staticRestrictions.connectorType', 'staticRestrictions.connectorPowerkW',
+ 'restrictions.minEnergyKWh', 'restrictions.maxEnergyKWh', 'restrictions.minDurationSecs', 'restrictions.maxDurationSecs',
+ 'dimensions.flatFee.active', 'dimensions.flatFee.price', 'dimensions.flatFee.stepSize', 'dimensions.flatFee.pricedData',
+ 'dimensions.energy.active', 'dimensions.energy.price', 'dimensions.energy.stepSize', 'dimensions.energy.pricedData',
+ 'dimensions.chargingTime.active', 'dimensions.chargingTime.price', 'dimensions.chargingTime.stepSize', 'dimensions.chargingTime.pricedData',
+ 'dimensions.parkingTime.active', 'dimensions.parkingTime.price', 'dimensions.parkingTime.stepSize', 'dimensions.parkingTime.pricedData',
+ ],
+ condition: {
+ Fn: 'custom:dynamicAuthorizations',
+ args: {
+ asserts: [],
+ filters: ['SitesAdmin']
+ }
+ },
+ },
+ { resource: Entity.PRICING_DEFINITION, action: [Action.CREATE, Action.READ, Action.UPDATE, Action.DELETE],
+ attributes: ['id', 'entityID', 'entityType', 'name', 'description', 'entityName',
+ 'staticRestrictions.validFrom', 'staticRestrictions.validTo', 'staticRestrictions.connectorType', 'staticRestrictions.connectorPowerkW',
+ 'restrictions.minEnergyKWh', 'restrictions.maxEnergyKWh', 'restrictions.minDurationSecs', 'restrictions.maxDurationSecs',
+ 'dimensions.flatFee.active', 'dimensions.flatFee.price', 'dimensions.flatFee.stepSize', 'dimensions.flatFee.pricedData',
+ 'dimensions.energy.active', 'dimensions.energy.price', 'dimensions.energy.stepSize', 'dimensions.energy.pricedData',
+ 'dimensions.chargingTime.active', 'dimensions.chargingTime.price', 'dimensions.chargingTime.stepSize', 'dimensions.chargingTime.pricedData',
+ 'dimensions.parkingTime.active', 'dimensions.parkingTime.price', 'dimensions.parkingTime.stepSize', 'dimensions.parkingTime.pricedData',
+ ],
+ condition: {
+ Fn: 'custom:dynamicAuthorizations',
+ args: {
+ asserts: [],
+ filters: ['SitesAdmin']
+ }
+ },
+ },
]
},
siteOwner: {
@@ -1246,6 +1280,24 @@ export const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
}
},
{ resource: Entity.REPORT, action: [Action.READ] },
+ {
+ resource: Entity.PRICING_DEFINITION, action: Action.LIST,
+ condition: {
+ Fn: 'custom:dynamicAuthorizations',
+ args: {
+ asserts: [],
+ filters: ['SitesOwner', 'LocalIssuer']
+ }
+ },
+ attributes: ['id', 'entityID', 'entityType', 'name', 'description', 'entityName',
+ 'staticRestrictions.validFrom', 'staticRestrictions.validTo', 'staticRestrictions.connectorType', 'staticRestrictions.connectorPowerkW',
+ 'restrictions.minEnergyKWh', 'restrictions.maxEnergyKWh', 'restrictions.minDurationSecs', 'restrictions.maxDurationSecs',
+ 'dimensions.flatFee.active', 'dimensions.flatFee.price', 'dimensions.flatFee.stepSize', 'dimensions.flatFee.pricedData',
+ 'dimensions.energy.active', 'dimensions.energy.price', 'dimensions.energy.stepSize', 'dimensions.energy.pricedData',
+ 'dimensions.chargingTime.active', 'dimensions.chargingTime.price', 'dimensions.chargingTime.stepSize', 'dimensions.chargingTime.pricedData',
+ 'dimensions.parkingTime.active', 'dimensions.parkingTime.price', 'dimensions.parkingTime.stepSize', 'dimensions.parkingTime.pricedData',
+ ],
+ },
]
},
};

try for authorizations
spoiler : does not work -> siteadmin cancreate where she's not admin !!?