Add authorization to determine filter presence
can list sites
can list site areas
MODIFY
src/server/rest/v1/service/AuthorizationService.ts
src/server/rest/v1/service/AuthorizationService.ts
@@ -275,6 +275,8 @@ export default class AuthorizationService {
assets.metadata = authorizationFilter.metadata;
// Add Authorizations
assets.canCreate = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.ASSET, Action.CREATE, authorizationFilter);
+ assets.canListSites = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE, Action.LIST, authorizationFilter);
+ assets.canListSiteAreas = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE_AREA, Action.LIST, authorizationFilter);
for (const asset of assets.result) {
await AuthorizationService.addAssetAuthorizations(tenant, userToken, asset, authorizationFilter);
}

MODIFY
src/types/DataResult.ts
src/types/DataResult.ts
@@ -96,4 +96,6 @@ export interface TransactionRefundDataResult {
export interface AssetDataResult extends DataResult<Asset> {
canCreate: boolean;
+ canListSites: boolean;
+ canListSiteAreas: boolean;
}

Add authorization to determine filter presence
- can list sites
- can list site areas