BL + typo + comments
MODIFY
src/authorization/Authorizations.ts
src/authorization/Authorizations.ts
@@ -327,7 +327,6 @@ export default class Authorizations {
}
-
public static async canListUsers(loggedUser: UserToken, authContext?: AuthorizationContext): Promise<AuthorizationResult> {
return Authorizations.can(loggedUser, Entity.USER, Action.LIST, authContext);
}

MODIFY
src/server/rest/v1/service/AuthorizationService.ts
src/server/rest/v1/service/AuthorizationService.ts
@@ -107,7 +107,7 @@ export default class AuthorizationService {
}
// eslint-disable-next-line max-len
- public static async addSiteUserAuthToUserAuthorizations(tenant: Tenant, userToken: UserToken, site: Site, users: User[], authorizationFilter: AuthorizationFilter): Promise<void> {
+ public static async addSiteUserAuthToUsersAuthorizations(tenant: Tenant, userToken: UserToken, site: Site, users: User[], authorizationFilter: AuthorizationFilter): Promise<void> {
for (const user of users) {
user.canAssignToSite = await AuthorizationService.canPerformAuthorizationAction(
tenant, userToken, Entity.SITE_USER, Action.ASSIGN_USERS_TO_SITE, authorizationFilter, { UserID: user.id }, site);
@@ -309,6 +309,7 @@ export default class AuthorizationService {
tenant, userToken, Entity.TRANSACTION, Action.LIST, authorizationFilter, { UserID: user.id }, user);
user.canSynchronizeBillingUser = await AuthorizationService.canPerformAuthorizationAction(
tenant, userToken, Entity.USER, Action.SYNCHRONIZE_BILLING_USER, authorizationFilter, { UserID: user.id }, user);
+ // Optimize data over the net
Utils.removeCanPropertiesWithFalseValue(user);
}

MODIFY
src/server/rest/v1/service/UtilsService.ts
src/server/rest/v1/service/UtilsService.ts
@@ -530,7 +530,7 @@ export default class UtilsService {
module: MODULE_NAME, method: 'checkAndGetSiteUsersAuthorization',
});
}
- await AuthorizationService.addSiteUserAuthToUserAuthorizations(tenant, userToken, site, users, authorizations);
+ await AuthorizationService.addSiteUserAuthToUsersAuthorizations(tenant, userToken, site, users, authorizations);
return users;
}

BL + typo + comments