usage of projectedFields
MODIFY
src/authorization/AuthorizationsDefinition.ts
src/authorization/AuthorizationsDefinition.ts
@@ -80,7 +80,7 @@ const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
'createdOn', 'lastChangedOn', 'errorCodeDetails', 'errorCode'
]
},
- { resource: Entity.USER, action: [Action.CREATE, Action.UPDATE, Action.SYNCHRONIZE_BILLING_USER] },
+ { resource: Entity.USER, action: Action.SYNCHRONIZE_BILLING_USER },
{
resource: Entity.USER, action: Action.DELETE,
condition: {
@@ -89,7 +89,7 @@ const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
}
},
{
- resource: Entity.USER, action: Action.READ,
+ resource: Entity.USER, action: [Action.READ, Action.CREATE, Action.UPDATE],
attributes: [
'id', 'name', 'firstName', 'email', 'role', 'status', 'issuer', 'locale', 'plateID',
'notificationsActive', 'notifications', 'phone', 'mobile', 'iNumber', 'costCenter', 'address', 'technical'

MODIFY
src/server/rest/v1/service/UserService.ts
src/server/rest/v1/service/UserService.ts
@@ -227,12 +227,12 @@ export default class UserService {
await UserStorage.saveUserRole(req.tenant, user.id, filteredRequest.role);
}
// Save Admin Data
- if (Utils.objectHasProperty(filteredRequest, 'plateID') || Utils.objectHasProperty(filteredRequest, 'technical')) {
+ if (user.projectedFields.includes('plateID') || user.projectedFields.includes('technical')) {
const adminData: { plateID?: string; technical?: boolean; } = {};
- if (Utils.objectHasProperty(filteredRequest, 'plateID')) {
+ if (user.projectedFields.includes('plateID')) {
adminData.plateID = filteredRequest.plateID || null;
}
- if (Utils.objectHasProperty(filteredRequest, 'technical')) {
+ if (user.projectedFields.includes('technical')) {
adminData.technical = filteredRequest.technical;
}
await UserStorage.saveUserAdminData(req.tenant, user.id, adminData);
@@ -694,7 +694,7 @@ export default class UserService {
adminData.notifications = newUser.notifications;
}
}
- if (Utils.objectHasProperty(newUser, 'technical')) {
+ if (authorizationFilter.projectFields.includes('technical')) {
adminData.technical = newUser.technical;
}
// Save User Admin data

usage of projectedFields