asv-hlps 1.2.80 → 1.2.81

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.js CHANGED
@@ -5,7 +5,7 @@ const user_1 = require("./user");
5
5
  const getAuth = (authUser, authSte, param) => {
6
6
  var _a, _b, _c, _d, _e;
7
7
  // let auth: boolean = false;
8
- if ((param === null || param === void 0 ? void 0 : param.tag) && (authUser === null || authUser === void 0 ? void 0 : authUser.tags)) {
8
+ if ((param === null || param === void 0 ? void 0 : param.tag) && (authUser === null || authUser === void 0 ? void 0 : authUser.tags.length)) {
9
9
  const tags = [];
10
10
  for (const tag of authUser.tags) {
11
11
  tags.push(tag.code.toLowerCase());
@@ -16,7 +16,8 @@ const getAuth = (authUser, authSte, param) => {
16
16
  }
17
17
  }
18
18
  if ((_a = param === null || param === void 0 ? void 0 : param.roles) === null || _a === void 0 ? void 0 : _a.length) {
19
- return (0, user_1.isStaffSte)(authSte, authUser) && ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase());
19
+ // return isStaffSte(authSte, authUser) && ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase());
20
+ return (0, user_1.isStaffSte)(authSte, authUser) ? ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase()) : false;
20
21
  // ------ multi roles ------
21
22
  // return param?.roles?.length ? this.checkRoles(["sadm", ...param.roles]) : false;
22
23
  // }
@@ -40,6 +41,7 @@ const getAuth = (authUser, authSte, param) => {
40
41
  return true;
41
42
  } */
42
43
  }
44
+ // ------ ste grps ------
43
45
  if ((_c = param === null || param === void 0 ? void 0 : param.steGrps) === null || _c === void 0 ? void 0 : _c.length) {
44
46
  return param.steGrps.includes(authUser.ste.grp.code.toLowerCase());
45
47
  }
package/lib/esm/auth.js CHANGED
@@ -2,7 +2,7 @@ import { isStaffSte } from "./user";
2
2
  const getAuth = (authUser, authSte, param) => {
3
3
  var _a, _b, _c, _d, _e;
4
4
  // let auth: boolean = false;
5
- if ((param === null || param === void 0 ? void 0 : param.tag) && (authUser === null || authUser === void 0 ? void 0 : authUser.tags)) {
5
+ if ((param === null || param === void 0 ? void 0 : param.tag) && (authUser === null || authUser === void 0 ? void 0 : authUser.tags.length)) {
6
6
  const tags = [];
7
7
  for (const tag of authUser.tags) {
8
8
  tags.push(tag.code.toLowerCase());
@@ -13,7 +13,8 @@ const getAuth = (authUser, authSte, param) => {
13
13
  }
14
14
  }
15
15
  if ((_a = param === null || param === void 0 ? void 0 : param.roles) === null || _a === void 0 ? void 0 : _a.length) {
16
- return isStaffSte(authSte, authUser) && ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase());
16
+ // return isStaffSte(authSte, authUser) && ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase());
17
+ return isStaffSte(authSte, authUser) ? ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase()) : false;
17
18
  // ------ multi roles ------
18
19
  // return param?.roles?.length ? this.checkRoles(["sadm", ...param.roles]) : false;
19
20
  // }
@@ -37,6 +38,7 @@ const getAuth = (authUser, authSte, param) => {
37
38
  return true;
38
39
  } */
39
40
  }
41
+ // ------ ste grps ------
40
42
  if ((_c = param === null || param === void 0 ? void 0 : param.steGrps) === null || _c === void 0 ? void 0 : _c.length) {
41
43
  return param.steGrps.includes(authUser.ste.grp.code.toLowerCase());
42
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.2.80",
3
+ "version": "1.2.81",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",