rez_core 6.5.46 → 6.5.47

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": "6.5.46",
3
+ "version": "6.5.47",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -1,4 +1,3 @@
1
- import { OrganizationData } from './../../enterprise/entity/organization.entity';
2
1
  import { Repository } from 'typeorm';
3
2
  import { UserData } from '../entity/user.entity';
4
3
  import { Injectable } from '@nestjs/common';
@@ -13,6 +13,7 @@ import { UpdateUserDto } from '../dto/update-user.dto';
13
13
  import { EnterpriseRepository } from 'src/module/enterprise/repository/enterprise.repository';
14
14
  import { StatusConstant } from '../../../constant/status.constant';
15
15
  import { RoleRepository } from '../repository/role.repository';
16
+ import { ReflectionHelper } from '../../../utils/service/reflection-helper.service';
16
17
 
17
18
  @Injectable()
18
19
  @ActionHandler('User')
@@ -23,6 +24,7 @@ export class UserService {
23
24
  private roleRepo: RoleRepository,
24
25
  private configService: ConfigService,
25
26
  private readonly enterpriseRepository: EnterpriseRepository,
27
+ private readonly reflectionHelper: ReflectionHelper
26
28
  ) {
27
29
  }
28
30
 
@@ -85,7 +87,6 @@ export class UserService {
85
87
 
86
88
  for (const entry of userData.access || []) {
87
89
  const { level_type, level_ids, app_code, role_id } = entry;
88
-
89
90
  if (
90
91
  !level_type ||
91
92
  !Array.isArray(level_ids) ||
@@ -95,12 +96,18 @@ export class UserService {
95
96
  ) {
96
97
  return { success: false, error: 'Invalid access level entry' };
97
98
  }
98
-
99
+ const appMasterRepo = this.reflectionHelper.getRepoService('AppMaster');
100
+ const appMaster = await appMasterRepo.findOne({
101
+ where: {
102
+ code: app_code
103
+ }
104
+ })
99
105
  for (const levelId of level_ids) {
100
106
  const userRoleMapping = new UserRoleMapping(savedData.id, role_id);
101
107
  userRoleMapping.level_type = level_type;
102
108
  userRoleMapping.level_id = String(levelId);
103
109
  userRoleMapping.appcode = app_code;
110
+ userRoleMapping.app_id = appMaster.id
104
111
  userRoleMapping.enterprise_id = loggedInUser?.enterprise_id || 0;
105
112
  insertPromises.push(
106
113
  this.userRoleMappingService.assignUserRole(userRoleMapping),