rez_core 2.0.93 → 2.0.94
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
|
@@ -62,7 +62,6 @@ export class ModuleAccessRepository {
|
|
|
62
62
|
}));
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
66
65
|
async getAllModulesByLevel(mainModIds: string[], appcode: string, levelType) {
|
|
67
66
|
const mainModules =
|
|
68
67
|
mainModIds.length === 1 && mainModIds[0] === '-1'
|
|
@@ -84,6 +83,23 @@ export class ModuleAccessRepository {
|
|
|
84
83
|
.andWhere('module.appcode = :appcode', { appcode })
|
|
85
84
|
.getMany();
|
|
86
85
|
|
|
86
|
+
const moduleCodes = allModules.map((m) => m.module_code);
|
|
87
|
+
|
|
88
|
+
const allActions = await this.moduleActionRepo.find({
|
|
89
|
+
where: { module_code: In(moduleCodes) },
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Map actions by module_code with full permission object
|
|
93
|
+
const actionMap = allActions.reduce((acc, action) => {
|
|
94
|
+
if (!acc[action.module_code]) acc[action.module_code] = [];
|
|
95
|
+
acc[action.module_code].push({
|
|
96
|
+
action: action.action_type,
|
|
97
|
+
name: action.action_name,
|
|
98
|
+
// You can also include action_type here if needed
|
|
99
|
+
});
|
|
100
|
+
return acc;
|
|
101
|
+
}, {} as Record<string, { action: string; name: string }[]>);
|
|
102
|
+
|
|
87
103
|
const levelsToReturn = levelType === 'ORG' ? ['ORG', 'SCH'] : ['SCH'];
|
|
88
104
|
|
|
89
105
|
const groupedByLevel: Record<string, any[]> = {};
|
|
@@ -101,7 +117,7 @@ export class ModuleAccessRepository {
|
|
|
101
117
|
.map((mod) => ({
|
|
102
118
|
name: mod.name,
|
|
103
119
|
code: mod.module_code,
|
|
104
|
-
permission: []
|
|
120
|
+
permission: actionMap[mod.module_code] || [],
|
|
105
121
|
submod: buildHierarchy(mod.wbs_code),
|
|
106
122
|
}));
|
|
107
123
|
|
|
@@ -110,7 +126,7 @@ export class ModuleAccessRepository {
|
|
|
110
126
|
.map((mod) => ({
|
|
111
127
|
name: mod.name,
|
|
112
128
|
code: mod.module_code,
|
|
113
|
-
permission: [],
|
|
129
|
+
permission: actionMap[mod.module_code] || [],
|
|
114
130
|
submod: buildHierarchy(mod.wbs_code),
|
|
115
131
|
}));
|
|
116
132
|
|
|
@@ -118,10 +134,9 @@ export class ModuleAccessRepository {
|
|
|
118
134
|
groupedByLevel[lvl] = levelModules;
|
|
119
135
|
}
|
|
120
136
|
}
|
|
121
|
-
|
|
122
137
|
return groupedByLevel;
|
|
123
138
|
}
|
|
124
|
-
|
|
139
|
+
|
|
125
140
|
|
|
126
141
|
async updateModuleAccess(
|
|
127
142
|
accessList: {
|