asv-hlps 1.3.76 → 1.3.77
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/lib/cjs/auth/auth.js +7 -4
- package/lib/esm/auth/auth.js +7 -4
- package/package.json +1 -1
package/lib/cjs/auth/auth.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAuth = void 0;
|
|
4
4
|
const user_1 = require("../users/user");
|
|
5
|
+
const arraySome = (arr1, arr2) => {
|
|
6
|
+
return arr1.some((x) => arr2.includes(x));
|
|
7
|
+
};
|
|
5
8
|
const getAuth = (authUser, authSte, param) => {
|
|
6
9
|
var _a, _b, _c, _d, _e, _f;
|
|
7
10
|
if ((param === null || param === void 0 ? void 0 : param.tag) && (authUser === null || authUser === void 0 ? void 0 : authUser.tags.length)) {
|
|
@@ -15,10 +18,10 @@ const getAuth = (authUser, authSte, param) => {
|
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
20
|
if (((_a = param === null || param === void 0 ? void 0 : param.roles) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
if ((0, user_1.isStaffSte)(authSte, authUser.ste.name) && ["sadm", ...param.roles]
|
|
21
|
+
/* if (isStaffSte(authSte, authUser.ste.name) && ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase())) {
|
|
22
|
+
return true;
|
|
23
|
+
} */
|
|
24
|
+
if ((0, user_1.isStaffSte)(authSte, authUser.ste.name) && arraySome(["sadm", ...param.roles], authUser.roles)) {
|
|
22
25
|
return true;
|
|
23
26
|
}
|
|
24
27
|
}
|
package/lib/esm/auth/auth.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { isStaffSte } from "../users/user";
|
|
2
|
+
const arraySome = (arr1, arr2) => {
|
|
3
|
+
return arr1.some((x) => arr2.includes(x));
|
|
4
|
+
};
|
|
2
5
|
const getAuth = (authUser, authSte, param) => {
|
|
3
6
|
var _a, _b, _c, _d, _e, _f;
|
|
4
7
|
if ((param === null || param === void 0 ? void 0 : param.tag) && (authUser === null || authUser === void 0 ? void 0 : authUser.tags.length)) {
|
|
@@ -12,10 +15,10 @@ const getAuth = (authUser, authSte, param) => {
|
|
|
12
15
|
}
|
|
13
16
|
}
|
|
14
17
|
if (((_a = param === null || param === void 0 ? void 0 : param.roles) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
15
|
-
if (isStaffSte(authSte, authUser.ste.name) && ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase())) {
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
if (isStaffSte(authSte, authUser.ste.name) && ["sadm", ...param.roles]
|
|
18
|
+
/* if (isStaffSte(authSte, authUser.ste.name) && ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase())) {
|
|
19
|
+
return true;
|
|
20
|
+
} */
|
|
21
|
+
if (isStaffSte(authSte, authUser.ste.name) && arraySome(["sadm", ...param.roles], authUser.roles)) {
|
|
19
22
|
return true;
|
|
20
23
|
}
|
|
21
24
|
}
|