rez_core 2.0.75 → 2.0.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "2.0.75",
3
+ "version": "2.0.76",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -192,29 +192,27 @@ export class UserService extends EntityServiceImpl {
192
192
  for (const entry of userDto.access) {
193
193
  const { id, level_type, level_ids, app_code, role_id } = entry;
194
194
 
195
- if (
196
- !level_type ||
197
- typeof level_ids !== 'number' ||
198
- !app_code ||
199
- !role_id
200
- ) {
195
+ if (!level_type || !app_code || !role_id || !Array.isArray(level_ids)) {
201
196
  throw new BadRequestException('Invalid access level entry');
202
197
  }
203
198
 
204
- const userRoleMapping = new UserRoleMapping(savedData.id, role_id);
205
- if (id) {
206
- userRoleMapping.id = id; // Use the existing ID if provided
199
+ for (const levelId of level_ids) {
200
+ const userRoleMapping = new UserRoleMapping(savedData.id, role_id);
201
+
202
+ if (id) {
203
+ userRoleMapping.id = id; // Use the existing ID if provided
204
+ }
205
+
206
+ userRoleMapping.level_type = level_type;
207
+ userRoleMapping.level_id = String(levelId);
208
+ userRoleMapping.appcode = app_code;
209
+ userRoleMapping.role_id = role_id;
210
+ userRoleMapping.organization_id =
211
+ loggedInUserData?.organization_id || 0;
212
+ insertPromises.push(
213
+ this.userRoleMappingService.assignUserRole(userRoleMapping),
214
+ );
207
215
  }
208
-
209
- userRoleMapping.role_id = role_id;
210
- userRoleMapping.appcode = app_code;
211
- userRoleMapping.level_id = String(level_ids); // level_ids is now a number
212
- userRoleMapping.level_type = level_type;
213
- userRoleMapping.organization_id = loggedInUserData.organization_id || 0;
214
-
215
- insertPromises.push(
216
- this.userRoleMappingService.updateAssignedRole(userRoleMapping),
217
- );
218
216
  }
219
217
 
220
218
  try {