adding canAssignUsers, canUnassignUsers to Sites
MODIFY
src/server/rest/v1/service/AuthorizationService.ts
src/server/rest/v1/service/AuthorizationService.ts
@@ -81,6 +81,8 @@ export default class AuthorizationService {
const siteAdminIDs = await AuthorizationService.getSiteAdminSiteIDs(tenant.id, userToken);
// Add canCreate flag to root
sites.canCreate = await Authorizations.canCreateSite(userToken);
+ sites.canAssignUsers = await Authorizations.canAssignUsersSites(userToken);
+ sites.canUnassignUsers = await Authorizations.canUnassignUsersSites(userToken);
// Enrich
for (const site of sites.result) {
await AuthorizationService.addSiteAuthorizations(tenant, userToken, site, siteAdminIDs);

MODIFY
src/types/Authorization.ts
src/types/Authorization.ts
@@ -173,6 +173,8 @@ export interface AuthorizationActions {
canCreate?: boolean;
canUpdate?: boolean;
canDelete?: boolean;
+ canAssignUsers?: boolean;
+ canUnassignUsers?: boolean;
}
export enum DynamicAuthorizationFilterName {

MODIFY
src/types/DataResult.ts
src/types/DataResult.ts
@@ -13,6 +13,8 @@ export interface CompanyDataResult extends DataResult<Company>{
}
export interface SiteDataResult extends DataResult<Site>{
canCreate: boolean;
+ canAssignUsers: boolean;
+ canUnassignUsers: boolean;
}
export interface SiteAreaDataResult extends DataResult<SiteArea>{

adding canAssignUsers, canUnassignUsers to Sites