Align sites authorization
MODIFY
src/server/rest/v1/service/AuthorizationService.ts
src/server/rest/v1/service/AuthorizationService.ts
@@ -62,8 +62,8 @@ export default class AuthorizationService {
// Add Meta Data
sites.metadata = authorizationFilter.metadata;
// Add Authorizations
- sites.canCreate = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE, Action.CREATE,
- authorizationFilter);
+ sites.canCreate = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.SITE, Action.CREATE, authorizationFilter);
+ sites.canListCompanies = await AuthorizationService.canPerformAuthorizationAction(tenant, userToken, Entity.COMPANY, Action.LIST, authorizationFilter);
for (const site of sites.result) {
await AuthorizationService.addSiteAuthorizations(tenant, userToken, site, authorizationFilter);
}

MODIFY
src/types/DataResult.ts
src/types/DataResult.ts
@@ -40,6 +40,7 @@ export interface SiteDataResult extends DataResult<Site> {
canCreate: boolean;
canAssignUsers: boolean;
canUnassignUsers: boolean;
+ canListCompanies: boolean;
}
export interface LogDataResult extends DataResult<Log> {

Align sites authorization