@mu-cabin/opms-permission 0.8.31 → 0.8.32
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/index.cjs +10 -10
- package/dist/index.mjs +10 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -205,11 +205,11 @@ function findFirstEnableNode(data) {
|
|
205
205
|
return null;
|
206
206
|
}
|
207
207
|
function handlePermissionTree(data, key) {
|
208
|
-
const
|
208
|
+
const noAuthMap = {};
|
209
209
|
function processNode(node) {
|
210
210
|
const processedChildren = node.children?.map((child) => processNode(child)).filter((child) => child !== null);
|
211
211
|
if (node.disabled) {
|
212
|
-
|
212
|
+
noAuthMap[node[key]] = { ...node, children: [] };
|
213
213
|
if (!processedChildren?.length) {
|
214
214
|
return null;
|
215
215
|
}
|
@@ -219,10 +219,10 @@ function handlePermissionTree(data, key) {
|
|
219
219
|
children: processedChildren || []
|
220
220
|
};
|
221
221
|
}
|
222
|
-
const
|
222
|
+
const tree = data.map((node) => processNode(node)).filter((node) => node !== null);
|
223
223
|
return {
|
224
|
-
|
225
|
-
|
224
|
+
tree,
|
225
|
+
noAuthMap
|
226
226
|
};
|
227
227
|
}
|
228
228
|
|
@@ -490,13 +490,13 @@ var Permission = class {
|
|
490
490
|
storage.setItem(USER_ORG_KEY, orgTreeData);
|
491
491
|
}
|
492
492
|
const data = handlePermissionTree(orgTreeData, "orgId");
|
493
|
-
const {
|
494
|
-
let {
|
495
|
-
if (
|
496
|
-
|
493
|
+
const { noAuthMap } = data;
|
494
|
+
let { tree } = data;
|
495
|
+
if (tree.length === 1 && tree[0].orgType === "HEAD" && tree[0].disabled) {
|
496
|
+
tree = tree[0].children || [];
|
497
497
|
}
|
498
498
|
this._orgTree = orgTreeData;
|
499
|
-
return { orgTree: orgTreeData, orgNoAuthMap, authOrgTree:
|
499
|
+
return { orgTree: orgTreeData, orgNoAuthMap: noAuthMap, authOrgTree: tree };
|
500
500
|
} catch (error) {
|
501
501
|
console.log(error);
|
502
502
|
return null;
|
package/dist/index.mjs
CHANGED
@@ -166,11 +166,11 @@ function findFirstEnableNode(data) {
|
|
166
166
|
return null;
|
167
167
|
}
|
168
168
|
function handlePermissionTree(data, key) {
|
169
|
-
const
|
169
|
+
const noAuthMap = {};
|
170
170
|
function processNode(node) {
|
171
171
|
const processedChildren = node.children?.map((child) => processNode(child)).filter((child) => child !== null);
|
172
172
|
if (node.disabled) {
|
173
|
-
|
173
|
+
noAuthMap[node[key]] = { ...node, children: [] };
|
174
174
|
if (!processedChildren?.length) {
|
175
175
|
return null;
|
176
176
|
}
|
@@ -180,10 +180,10 @@ function handlePermissionTree(data, key) {
|
|
180
180
|
children: processedChildren || []
|
181
181
|
};
|
182
182
|
}
|
183
|
-
const
|
183
|
+
const tree = data.map((node) => processNode(node)).filter((node) => node !== null);
|
184
184
|
return {
|
185
|
-
|
186
|
-
|
185
|
+
tree,
|
186
|
+
noAuthMap
|
187
187
|
};
|
188
188
|
}
|
189
189
|
|
@@ -451,13 +451,13 @@ var Permission = class {
|
|
451
451
|
storage.setItem(USER_ORG_KEY, orgTreeData);
|
452
452
|
}
|
453
453
|
const data = handlePermissionTree(orgTreeData, "orgId");
|
454
|
-
const {
|
455
|
-
let {
|
456
|
-
if (
|
457
|
-
|
454
|
+
const { noAuthMap } = data;
|
455
|
+
let { tree } = data;
|
456
|
+
if (tree.length === 1 && tree[0].orgType === "HEAD" && tree[0].disabled) {
|
457
|
+
tree = tree[0].children || [];
|
458
458
|
}
|
459
459
|
this._orgTree = orgTreeData;
|
460
|
-
return { orgTree: orgTreeData, orgNoAuthMap, authOrgTree:
|
460
|
+
return { orgTree: orgTreeData, orgNoAuthMap: noAuthMap, authOrgTree: tree };
|
461
461
|
} catch (error) {
|
462
462
|
console.log(error);
|
463
463
|
return null;
|