rez_core 5.0.165 → 5.0.167
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/dist/module/dashboard/service/dashboard.service.js +1 -1
- package/dist/module/dashboard/service/dashboard.service.js.map +1 -1
- package/dist/module/listmaster/entity/list-master.entity.d.ts +1 -0
- package/dist/module/listmaster/entity/list-master.entity.js +4 -0
- package/dist/module/listmaster/entity/list-master.entity.js.map +1 -1
- package/dist/module/meta/service/entity-dynamic.service.js +1 -1
- package/dist/module/meta/service/entity-dynamic.service.js.map +1 -1
- package/dist/module/module/controller/module-access.controller.d.ts +1 -1
- package/dist/module/module/controller/module-access.controller.js +6 -8
- package/dist/module/module/controller/module-access.controller.js.map +1 -1
- package/dist/module/module/repository/menu.repository.js +1 -1
- package/dist/module/module/repository/menu.repository.js.map +1 -1
- package/dist/module/module/service/module-access.service.d.ts +3 -4
- package/dist/module/module/service/module-access.service.js +7 -14
- package/dist/module/module/service/module-access.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/dashboard/service/dashboard.service.ts +1 -1
- package/src/module/listmaster/entity/list-master.entity.ts +3 -0
- package/src/module/meta/service/entity-dynamic.service.ts +1 -1
- package/src/module/module/controller/module-access.controller.ts +5 -6
- package/src/module/module/repository/menu.repository.ts +1 -1
- package/src/module/module/service/module-access.service.ts +22 -32
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ export class DashboardService {
|
|
|
20
20
|
appcode: loggedInUser.appcode,
|
|
21
21
|
level_type: loggedInUser.level_type,
|
|
22
22
|
level_id: loggedInUser.level_id,
|
|
23
|
-
|
|
23
|
+
enterprise_id: loggedInUser.enterprise_id,
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
// Build a set of accessible codes
|
|
@@ -29,13 +29,12 @@ export class ModuleAccessController {
|
|
|
29
29
|
@Query('include') include: string, // ✅ declare it as boolean
|
|
30
30
|
@Request() req,
|
|
31
31
|
) {
|
|
32
|
-
const { level_type, level_id
|
|
32
|
+
const { level_type, level_id } = req.user.userData;
|
|
33
33
|
|
|
34
34
|
return this.moduleAccessService.getRoles({
|
|
35
35
|
appcode,
|
|
36
36
|
level_type,
|
|
37
37
|
level_id,
|
|
38
|
-
organization_id,
|
|
39
38
|
include: include === 'true', // ensure it's either true or false
|
|
40
39
|
});
|
|
41
40
|
}
|
|
@@ -84,7 +83,7 @@ export class ModuleAccessController {
|
|
|
84
83
|
}
|
|
85
84
|
|
|
86
85
|
@Post('update')
|
|
87
|
-
async updateModuleAccess(@Body() moduleAccessData: any[]
|
|
86
|
+
async updateModuleAccess(@Body() moduleAccessData: any[]) {
|
|
88
87
|
return this.moduleAccessService.updateModuleAccess(moduleAccessData);
|
|
89
88
|
}
|
|
90
89
|
|
|
@@ -117,9 +116,9 @@ export class ModuleAccessController {
|
|
|
117
116
|
const appcode = userData?.appcode;
|
|
118
117
|
const level_type = userData?.level_type;
|
|
119
118
|
const level_id = userData?.level_id;
|
|
120
|
-
const
|
|
119
|
+
const enterprise_id = userData?.enterprise_id;
|
|
121
120
|
|
|
122
|
-
if (!userId || !appcode || !level_type || !level_id || !
|
|
121
|
+
if (!userId || !appcode || !level_type || !level_id || !enterprise_id) {
|
|
123
122
|
throw new BadRequestException('Invalid token data');
|
|
124
123
|
}
|
|
125
124
|
|
|
@@ -128,7 +127,7 @@ export class ModuleAccessController {
|
|
|
128
127
|
appcode,
|
|
129
128
|
level_type,
|
|
130
129
|
level_id,
|
|
131
|
-
|
|
130
|
+
enterprise_id,
|
|
132
131
|
});
|
|
133
132
|
}
|
|
134
133
|
}
|
|
@@ -21,26 +21,25 @@ export class ModuleAccessService {
|
|
|
21
21
|
private readonly dataSource: DataSource,
|
|
22
22
|
@Inject('ListMasterService')
|
|
23
23
|
private readonly listMasterService: ListMasterService,
|
|
24
|
-
private readonly reflectionHelper: ReflectionHelper
|
|
25
|
-
) {
|
|
24
|
+
private readonly reflectionHelper: ReflectionHelper,
|
|
25
|
+
) {
|
|
26
|
+
}
|
|
26
27
|
|
|
27
|
-
async getModules({ appcode,loggedInUser }: { appcode: string
|
|
28
|
+
async getModules({ appcode, loggedInUser }: { appcode: string, loggedInUser: UserData }) {
|
|
28
29
|
return this.moduleAccessRepository.getModules({
|
|
29
|
-
appcode,loggedInUser
|
|
30
|
+
appcode, loggedInUser,
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
async getRoles({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}: {
|
|
35
|
+
appcode,
|
|
36
|
+
level_type,
|
|
37
|
+
level_id,
|
|
38
|
+
include,
|
|
39
|
+
}: {
|
|
40
40
|
appcode: string;
|
|
41
41
|
level_type?: string;
|
|
42
42
|
level_id?: number;
|
|
43
|
-
organization_id?: number;
|
|
44
43
|
include?: boolean;
|
|
45
44
|
}) {
|
|
46
45
|
const query = this.dataSource
|
|
@@ -54,17 +53,8 @@ export class ModuleAccessService {
|
|
|
54
53
|
query.andWhere('(role.is_factory IS NULL OR role.is_factory != 1)');
|
|
55
54
|
}
|
|
56
55
|
|
|
57
|
-
if (level_type) {
|
|
56
|
+
if (level_type && level_id) {
|
|
58
57
|
query.andWhere('role.level_type = :level_type', { level_type });
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (organization_id) {
|
|
62
|
-
query.andWhere('role.organization_id = :organization_id', {
|
|
63
|
-
organization_id,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (level_id !== undefined) {
|
|
68
58
|
query.andWhere('role.level_id = :level_id', {
|
|
69
59
|
level_id: String(level_id),
|
|
70
60
|
});
|
|
@@ -139,17 +129,17 @@ export class ModuleAccessService {
|
|
|
139
129
|
}
|
|
140
130
|
|
|
141
131
|
async getUserPermissions({
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
132
|
+
userId,
|
|
133
|
+
appcode,
|
|
134
|
+
level_type,
|
|
135
|
+
level_id,
|
|
136
|
+
enterprise_id,
|
|
137
|
+
}: {
|
|
148
138
|
userId: number;
|
|
149
139
|
appcode: string;
|
|
150
140
|
level_type: string;
|
|
151
141
|
level_id: number;
|
|
152
|
-
|
|
142
|
+
enterprise_id: number;
|
|
153
143
|
}) {
|
|
154
144
|
// Step 1: Resolve roles
|
|
155
145
|
const roleCodes = await this.menuRepository.resolveUserRoles(
|
|
@@ -174,17 +164,17 @@ export class ModuleAccessService {
|
|
|
174
164
|
|
|
175
165
|
// Step 3: If level_type is SCH, check school status using raw query
|
|
176
166
|
if (level_type === 'SCH') {
|
|
177
|
-
const schoolRepo =
|
|
167
|
+
const schoolRepo = this.reflectionHelper.getRepoService('SSOSchool');
|
|
178
168
|
|
|
179
169
|
const school = await schoolRepo.findOne({
|
|
180
170
|
where: {
|
|
181
|
-
id: level_id
|
|
182
|
-
}
|
|
171
|
+
id: level_id,
|
|
172
|
+
},
|
|
183
173
|
});
|
|
184
174
|
|
|
185
175
|
const resolveStatus = await this.listMasterService.getResolvedListCode(
|
|
186
176
|
STATUS_INACTIVE,
|
|
187
|
-
|
|
177
|
+
enterprise_id || 0,
|
|
188
178
|
);
|
|
189
179
|
|
|
190
180
|
if (!school || school.status === resolveStatus.id) {
|