Fixed authorization for create consumption
MODIFY
src/server/rest/v1/service/AuthorizationService.ts
src/server/rest/v1/service/AuthorizationService.ts
@@ -284,6 +284,8 @@ export default class AuthorizationService {
await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.ASSET, Action.RETRIEVE_CONSUMPTION, authorizationFilter, {}, asset);
asset.canReadConsumption = asset.dynamicAsset &&
await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.ASSET, Action.READ_CONSUMPTION, authorizationFilter, {}, asset);
+ asset.canCreateConsumption = asset.dynamicAsset && asset.usesPushAPI &&
+ await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.ASSET, Action.CREATE_CONSUMPTION, authorizationFilter, {}, asset);
// Optimize data over the net
Utils.removeCanPropertiesWithFalseValue(asset);
}

MODIFY
src/types/Authorization.ts
src/types/Authorization.ts
@@ -201,6 +201,7 @@ export interface AssetAuthorizationActions extends AuthorizationActions {
canRetrieveConsumption?:boolean;
canReadConsumption?:boolean;
canCheckConnection?:boolean;
+ canCreateConsumption?:boolean;
}
export interface SiteAreaAuthorizationActions extends AuthorizationActions {

Fixed authorization for create consumption