rez_core 6.5.56 → 6.5.58
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
|
@@ -23,10 +23,10 @@ export class ModuleAccessRepository {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
async getRoles({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
appcode,
|
|
27
|
+
level_type,
|
|
28
|
+
level_id,
|
|
29
|
+
}: {
|
|
30
30
|
appcode: string;
|
|
31
31
|
level_type?: string;
|
|
32
32
|
level_id?: number;
|
|
@@ -58,9 +58,9 @@ export class ModuleAccessRepository {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
async getModules({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
appcode,
|
|
62
|
+
loggedInUser,
|
|
63
|
+
}: {
|
|
64
64
|
appcode: string;
|
|
65
65
|
loggedInUser: any;
|
|
66
66
|
}) {
|
|
@@ -157,15 +157,16 @@ export class ModuleAccessRepository {
|
|
|
157
157
|
module_id: access.module_id,
|
|
158
158
|
level_type: access.level_type,
|
|
159
159
|
app_id: access.app_id,
|
|
160
|
-
code: access
|
|
160
|
+
code: access?.module?.module_code,
|
|
161
161
|
appcode: access.app.code,
|
|
162
162
|
})),
|
|
163
163
|
}));
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
async getAllModulesByLevel(mainModIds: string[], appcode: string, levelType) {
|
|
167
|
+
|
|
167
168
|
const appMasterRepo = this.reflectionHelper.getRepoService('AppMaster');
|
|
168
|
-
// TODO Permissions not getting populated
|
|
169
|
+
// TODO Permissions not getting populated
|
|
169
170
|
const appMaster = await appMasterRepo.find({
|
|
170
171
|
where: {
|
|
171
172
|
code: appcode,
|
|
@@ -209,28 +210,25 @@ export class ModuleAccessRepository {
|
|
|
209
210
|
|
|
210
211
|
const modules = allModules.map((m) => m.id);
|
|
211
212
|
|
|
212
|
-
const allActions
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
const allActions = await this.moduleActionRepo.find({
|
|
214
|
+
where: {
|
|
215
|
+
module_id: In(modules),
|
|
216
|
+
}
|
|
217
|
+
})
|
|
217
218
|
|
|
218
219
|
// Map actions by module_code with VIEW action first
|
|
219
220
|
const actionMap = allActions.reduce(
|
|
220
221
|
(acc, action) => {
|
|
221
|
-
if (!acc[action
|
|
222
|
-
|
|
222
|
+
if (!acc[action?.module_id]) acc[action?.module_id] = [];
|
|
223
223
|
const actionItem = {
|
|
224
224
|
action: action.action_code,
|
|
225
225
|
name: action.action_name,
|
|
226
226
|
};
|
|
227
|
-
|
|
228
227
|
if (action.action_code === 'VIEW') {
|
|
229
|
-
acc[action
|
|
228
|
+
acc[action?.module_id].unshift(actionItem); // ➕ Add VIEW at start
|
|
230
229
|
} else {
|
|
231
|
-
acc[action
|
|
230
|
+
acc[action?.module_id].push(actionItem); // ➕ Add others at end
|
|
232
231
|
}
|
|
233
|
-
|
|
234
232
|
return acc;
|
|
235
233
|
},
|
|
236
234
|
{} as Record<string, { action: string; name: string }[]>,
|
|
@@ -255,7 +253,7 @@ export class ModuleAccessRepository {
|
|
|
255
253
|
name: mod.name,
|
|
256
254
|
module_id: mod.id,
|
|
257
255
|
code: mod.module_code,
|
|
258
|
-
permission: actionMap[mod.
|
|
256
|
+
permission: actionMap[mod.id] || [],
|
|
259
257
|
submod: buildHierarchy(mod.wbs_code),
|
|
260
258
|
}));
|
|
261
259
|
|
|
@@ -265,7 +263,7 @@ export class ModuleAccessRepository {
|
|
|
265
263
|
name: mod.name,
|
|
266
264
|
module_id: mod.id,
|
|
267
265
|
code: mod.module_code,
|
|
268
|
-
permission: actionMap[mod.
|
|
266
|
+
permission: actionMap[mod.id] || [],
|
|
269
267
|
submod: buildHierarchy(mod.wbs_code),
|
|
270
268
|
}));
|
|
271
269
|
|