Added created/lastChanged in Company/Site/Site Areas
MODIFY
src/server/rest/service/CompanyService.ts
src/server/rest/service/CompanyService.ts
@@ -141,7 +141,7 @@ export default class CompanyService {
locMaxDistanceMeters: filteredRequest.LocMaxDistanceMeters,
},
{ limit: filteredRequest.Limit, skip: filteredRequest.Skip, sort: filteredRequest.Sort, onlyRecordCount: filteredRequest.OnlyRecordCount },
- [ 'id', 'name', 'address', 'logo', 'issuer', 'distanceMeters']
+ [ 'id', 'name', 'address', 'logo', 'issuer', 'distanceMeters', 'createdOn', 'createdBy', 'lastChangedOn', 'lastChangedBy']
);
// Filter
CompanySecurity.filterCompaniesResponse(companies, req.user);

MODIFY
src/server/rest/service/SiteAreaService.ts
src/server/rest/service/SiteAreaService.ts
@@ -305,7 +305,7 @@ export default class SiteAreaService {
},
{ limit: filteredRequest.Limit, skip: filteredRequest.Skip, sort: filteredRequest.Sort, onlyRecordCount: filteredRequest.OnlyRecordCount },
['id', 'name', 'siteID', 'maximumPower', 'numberOfPhases', 'accessControl', 'smartCharging', 'address',
- 'site.id', 'site.name', 'issuer', 'distanceMeters']
+ 'site.id', 'site.name', 'issuer', 'distanceMeters', 'createdOn', 'createdBy', 'lastChangedOn', 'lastChangedBy']
);
// Filter
SiteAreaSecurity.filterSiteAreasResponse(siteAreas, req.user);

MODIFY
src/server/rest/service/SiteService.ts
src/server/rest/service/SiteService.ts
@@ -393,7 +393,7 @@ export default class SiteService {
onlyRecordCount: filteredRequest.OnlyRecordCount
},
['id', 'name', 'address', 'companyID', 'company.name', 'autoUserSiteAssignment', 'issuer',
- 'autoUserSiteAssignment', 'distanceMeters', 'public']
+ 'autoUserSiteAssignment', 'distanceMeters', 'public', 'createdOn', 'createdBy', 'lastChangedOn', 'lastChangedBy']
);
// Build the result
if (sites.result && sites.result.length > 0) {

MODIFY
src/server/rest/service/security/CompanySecurity.ts
src/server/rest/service/security/CompanySecurity.ts
@@ -87,8 +87,9 @@ export default class CompanySecurity {
filteredCompany.distanceMeters = company.distanceMeters;
}
// Created By / Last Changed By
- UtilsSecurity.filterCreatedAndLastChanged(
- filteredCompany, company, loggedUser);
+ if (Authorizations.canUpdateCompany(loggedUser)) {
+ UtilsSecurity.filterCreatedAndLastChanged(filteredCompany, company, loggedUser);
+ }
}
return filteredCompany;
}

MODIFY
src/server/rest/service/security/SiteAreaSecurity.ts
src/server/rest/service/security/SiteAreaSecurity.ts
@@ -123,8 +123,10 @@ export default class SiteAreaSecurity {
filteredSiteArea.distanceMeters = siteArea.distanceMeters;
}
// Created By / Last Changed By
+ if (Authorizations.canUpdateSiteArea(loggedUser, siteArea.siteID)) {
UtilsSecurity.filterCreatedAndLastChanged(filteredSiteArea, siteArea, loggedUser);
}
+ }
return filteredSiteArea;
}

MODIFY
src/server/rest/service/security/SiteSecurity.ts
src/server/rest/service/security/SiteSecurity.ts
@@ -146,8 +146,10 @@ export default class SiteSecurity {
filteredSite.distanceMeters = site.distanceMeters;
}
// Created By / Last Changed By
+ if (Authorizations.canUpdateSite(loggedUser, site.id)) {
UtilsSecurity.filterCreatedAndLastChanged(filteredSite, site, loggedUser);
}
+ }
return filteredSite;
}

Added created/lastChanged in Company/Site/Site Areas