move projectedFields
MODIFY
src/server/rest/v1/service/UserService.ts
src/server/rest/v1/service/UserService.ts
@@ -307,14 +307,11 @@ export default class UserService {
// Filter
const filteredRequest = UserValidator.getInstance().validateUserGetByID(req.query);
UtilsService.assertIdIsProvided(action, filteredRequest.ID, MODULE_NAME, 'handleGetUser', req.user);
- // Get dynamic auth
- const authorizationFilter = await AuthorizationService.checkAndGetUserAuthorizations(req.tenant, req.user, { ID: filteredRequest.ID.toString() }, Action.READ);
// Check and Get User
const user = await UtilsService.checkAndGetUserAuthorization(
req.tenant, req.user, filteredRequest.ID.toString(), Action.READ, action, null, {
withImage: true
}, true, false);
- user.projectedFields = authorizationFilter.projectFields;
res.json(user);
next();
}

MODIFY
src/server/rest/v1/service/UtilsService.ts
src/server/rest/v1/service/UtilsService.ts
@@ -181,6 +181,9 @@ export default class UtilsService {
},
applyProjectFields ? authorizationFilter.projectFields : null
);
+ if (authorizationFilter.projectFields) {
+ user.projectedFields = authorizationFilter.projectFields;
+ }
UtilsService.assertObjectExists(action, user, `User ID '${userID}' does not exist`,
MODULE_NAME, 'checkAndGetUserAuthorization', userToken);
// External User

move projectedFields