use projectedFields
MODIFY
src/authorization/AuthorizationsDefinition.ts
src/authorization/AuthorizationsDefinition.ts
@@ -726,7 +726,7 @@ const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
},
attributes: [
'id', 'name', 'firstName', 'email', 'role', 'status', 'issuer', 'locale', 'plateID',
- 'notificationsActive', 'notifications', 'phone', 'mobile', 'iNumber', 'costCenter', 'address'
+ 'notificationsActive', 'notifications', 'phone', 'mobile', 'iNumber', 'costCenter', 'address', 'technical'
],
},
{

MODIFY
src/server/rest/v1/service/UserService.ts
src/server/rest/v1/service/UserService.ts
@@ -307,11 +307,14 @@ 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/types/User.ts
src/types/User.ts
@@ -42,6 +42,7 @@ export default interface User extends CreatedUpdatedProps, AuthorizationActions
autoActivateUserAtImport: boolean;
};
technical: boolean;
+ projectedFields: string[];
}
export interface UserSite {

use projectedFields