ais_auth_lib 1.0.10 → 1.0.11
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/conditions.js +12 -7
- package/package.json +1 -1
package/dist/conditions.js
CHANGED
|
@@ -2,22 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPropertiesByPath = exports.evaluateConditionGroup = exports.evaluateCondition = exports.resolveDynamicValue = void 0;
|
|
4
4
|
function resolveDynamicValue(condition, context) {
|
|
5
|
-
if (!context)
|
|
5
|
+
if (!(context === null || context === void 0 ? void 0 : context.user))
|
|
6
6
|
return undefined;
|
|
7
7
|
switch (condition.attribute) {
|
|
8
8
|
case "userUid":
|
|
9
|
-
if (condition.value
|
|
9
|
+
if (condition.value === "me") {
|
|
10
10
|
return context.user.uid;
|
|
11
11
|
}
|
|
12
12
|
break;
|
|
13
13
|
case "resources.*.companies.*.division.uid":
|
|
14
|
-
if (
|
|
15
|
-
return
|
|
14
|
+
if (!Array.isArray(context.user.companies)) {
|
|
15
|
+
return undefined;
|
|
16
16
|
}
|
|
17
|
-
if (condition.value
|
|
17
|
+
if (condition.value === "my_division") {
|
|
18
18
|
return context.user.companies
|
|
19
|
-
.map((company) => company.division.
|
|
20
|
-
.filter(
|
|
19
|
+
.map((company) => { var _a; return (_a = company === null || company === void 0 ? void 0 : company.division) === null || _a === void 0 ? void 0 : _a.uid; })
|
|
20
|
+
.filter(Boolean);
|
|
21
|
+
}
|
|
22
|
+
if (condition.value === "parent_division") {
|
|
23
|
+
return context.user.companies
|
|
24
|
+
.map((company) => { var _a; return (_a = company === null || company === void 0 ? void 0 : company.division) === null || _a === void 0 ? void 0 : _a.parentUid; })
|
|
25
|
+
.filter(Boolean);
|
|
21
26
|
}
|
|
22
27
|
}
|
|
23
28
|
return undefined;
|