asv-hlps 1.3.18 → 1.3.20
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.d.ts +9 -3
- package/lib/cjs/auth.js +30 -63
- package/lib/cjs/utils.d.ts +1 -0
- package/lib/cjs/utils.js +8 -2
- package/lib/esm/auth.d.ts +9 -3
- package/lib/esm/auth.js +30 -63
- package/lib/esm/utils.d.ts +1 -0
- package/lib/esm/utils.js +6 -1
- package/package.json +1 -1
package/lib/cjs/auth.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UserNotarial } from "./models/entities/users/UserNotatial";
|
|
1
|
+
import { AuthTag, Ste, SteGrp, UserGrp, UserRole } from "./models";
|
|
3
2
|
interface AuthParam {
|
|
4
3
|
tag?: string;
|
|
5
4
|
roles?: string[];
|
|
@@ -17,5 +16,12 @@ interface AuthParam {
|
|
|
17
16
|
steNames?: string[];
|
|
18
17
|
url?: string;
|
|
19
18
|
}
|
|
20
|
-
|
|
19
|
+
type TData = {
|
|
20
|
+
tags?: AuthTag[];
|
|
21
|
+
ste: Ste;
|
|
22
|
+
role: UserRole;
|
|
23
|
+
grp: UserGrp;
|
|
24
|
+
steGrp: SteGrp;
|
|
25
|
+
};
|
|
26
|
+
declare const getAuth: <T extends TData>(authUser: T, authSte: string[], param?: AuthParam) => boolean;
|
|
21
27
|
export { AuthParam, getAuth };
|
package/lib/cjs/auth.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAuth = void 0;
|
|
4
4
|
const user_1 = require("./user");
|
|
5
|
+
// const getAuth = <T extends TData>(authUser: User | UserNotarial, authSte: string[], param?: AuthParam) => {
|
|
5
6
|
const getAuth = (authUser, authSte, param) => {
|
|
6
7
|
var _a, _b, _c, _d, _e, _f;
|
|
7
|
-
// let auth: boolean = false;
|
|
8
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) {
|
|
@@ -15,85 +15,52 @@ const getAuth = (authUser, authSte, param) => {
|
|
|
15
15
|
return true;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
/* if (param?.roles?.length) {
|
|
19
|
-
if (isStaffSte(authSte, authUser)) {
|
|
20
|
-
return param?.roles?.length ? ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase()) : false;
|
|
21
|
-
// ------ multi roles ------
|
|
22
|
-
// return param?.roles?.length ? this.checkRoles(["sadm", ...param.roles]) : false;
|
|
23
|
-
}
|
|
24
|
-
} */
|
|
25
18
|
if (((_a = param === null || param === void 0 ? void 0 : param.roles) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// return param?.roles?.length ? this.checkRoles(["sadm", ...param.roles]) : false;
|
|
30
|
-
// }
|
|
19
|
+
if ((0, user_1.isStaffSte)(authSte, authUser.ste.name) && ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase())) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
31
22
|
}
|
|
32
23
|
// ------ staff ------
|
|
33
24
|
if (param === null || param === void 0 ? void 0 : param.staff) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// return param?.roles?.length ? this.checkRoles(["sadm", ...param.roles]) : false;
|
|
40
|
-
// }
|
|
25
|
+
if (((_b = param === null || param === void 0 ? void 0 : param.staff.roles) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
|
|
26
|
+
(0, user_1.isStaffSte)(authSte, authUser.ste.name) &&
|
|
27
|
+
["sadm", ...param.roles].includes(authUser.role.code.toLowerCase())) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
41
30
|
}
|
|
42
31
|
// ------ client ------
|
|
43
32
|
if (param === null || param === void 0 ? void 0 : param.client) {
|
|
44
33
|
if (!(0, user_1.isStaffSte)(authSte, authUser.ste.name)) {
|
|
45
|
-
if (param.client.roles &&
|
|
46
|
-
|
|
34
|
+
if (param.client.roles &&
|
|
35
|
+
!param.client.steGrps &&
|
|
36
|
+
param.client.roles.length > 0 &&
|
|
37
|
+
["ceo", ...param === null || param === void 0 ? void 0 : param.client.roles].includes(authUser.role.code.toLowerCase())) {
|
|
38
|
+
return true;
|
|
47
39
|
}
|
|
48
|
-
if (!param.client.roles &&
|
|
49
|
-
|
|
40
|
+
if (!param.client.roles &&
|
|
41
|
+
param.client.steGrps &&
|
|
42
|
+
param.client.steGrps.length &&
|
|
43
|
+
param.client.steGrps.includes(authUser.ste.grp.code.toLowerCase())) {
|
|
44
|
+
return true;
|
|
50
45
|
}
|
|
51
|
-
|
|
46
|
+
if (((_c = param === null || param === void 0 ? void 0 : param.client.roles) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
52
47
|
(param === null || param === void 0 ? void 0 : param.client.steGrps.length) &&
|
|
53
48
|
["ceo", ...param === null || param === void 0 ? void 0 : param.client.roles].includes(authUser.role.code.toLowerCase()) &&
|
|
54
|
-
(param === null || param === void 0 ? void 0 : param.client.steGrps).includes(authUser.ste.grp.code.toLowerCase()))
|
|
49
|
+
(param === null || param === void 0 ? void 0 : param.client.steGrps).includes(authUser.ste.grp.code.toLowerCase())) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
55
52
|
}
|
|
56
|
-
/* const authIn = param.steGrps.includes(this.authUser.ste.grp.code.toLowerCase());
|
|
57
|
-
if (authIn) {
|
|
58
|
-
return true;
|
|
59
|
-
} */
|
|
60
53
|
}
|
|
61
54
|
// ------ ste grps ------
|
|
62
|
-
if ((_d = param === null || param === void 0 ? void 0 : param.steGrps) === null || _d === void 0 ? void 0 : _d.length) {
|
|
63
|
-
return
|
|
55
|
+
if (((_d = param === null || param === void 0 ? void 0 : param.steGrps) === null || _d === void 0 ? void 0 : _d.length) > 0 && param.steGrps.includes(authUser.ste.grp.code.toLowerCase())) {
|
|
56
|
+
return true;
|
|
64
57
|
}
|
|
65
|
-
if ((_e = param === null || param === void 0 ? void 0 : param.grps) === null || _e === void 0 ? void 0 : _e.length) {
|
|
66
|
-
return
|
|
58
|
+
if (((_e = param === null || param === void 0 ? void 0 : param.grps) === null || _e === void 0 ? void 0 : _e.length) && param.grps.includes(authUser.grp.code.toLowerCase())) {
|
|
59
|
+
return true;
|
|
67
60
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (param.client.roles && !param.client.steGrps) {
|
|
71
|
-
return param.client.roles.length ? ["ceo", ...param?.client.roles].includes(authUser.role.code.toLowerCase()) : false;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (!param.client.roles && param.client.steGrps) {
|
|
75
|
-
return param.client.steGrps.length ? param.client.steGrps.includes(authUser.ste.grp.code.toLowerCase()) : false;
|
|
76
|
-
}
|
|
77
|
-
return param?.client.roles?.length && param?.client.steGrps.length
|
|
78
|
-
? ["ceo", ...param?.client.roles].includes(authUser.role.code.toLowerCase()) &&
|
|
79
|
-
(param?.client.steGrps).includes(authUser.ste.grp.code.toLowerCase())
|
|
80
|
-
: false;
|
|
81
|
-
}
|
|
82
|
-
const authIn = (param.steGrps).includes(this.authUser.ste.grp.code.toLowerCase());
|
|
83
|
-
if(authIn) { return true}
|
|
84
|
-
} */
|
|
85
|
-
if ((_f = param === null || param === void 0 ? void 0 : param.steNames) === null || _f === void 0 ? void 0 : _f.length) {
|
|
86
|
-
return param.steNames.includes(authUser.ste.name.toLowerCase());
|
|
87
|
-
/* const authIn = (param.steGrps).includes(this.authUser.ste.grp.code.toLowerCase());
|
|
88
|
-
if(authIn) { return true} */
|
|
61
|
+
if (((_f = param === null || param === void 0 ? void 0 : param.steNames) === null || _f === void 0 ? void 0 : _f.length) > 0 && param.steNames.includes(authUser.ste.name.toLowerCase())) {
|
|
62
|
+
return true;
|
|
89
63
|
}
|
|
90
|
-
|
|
91
|
-
return this.router.url === param.url;
|
|
92
|
-
} */
|
|
93
|
-
// return false;
|
|
94
|
-
// return auth;
|
|
95
|
-
/* if(param?.steGrps?.length) {
|
|
96
|
-
auth = (param.steGrps).includes(this.authUser.ste.grp.code.toLowerCase());
|
|
97
|
-
} */
|
|
64
|
+
return false;
|
|
98
65
|
};
|
|
99
66
|
exports.getAuth = getAuth;
|
package/lib/cjs/utils.d.ts
CHANGED
|
@@ -101,3 +101,4 @@ export declare const monthStringName: (date: string | Date, format?: "MMM" | "MM
|
|
|
101
101
|
export declare const dateFormatter: (date: Date | string, format?: "y" | "ymd" | "dmy" | "dmy-hm" | "dmyfr" | "myfr" | "mfr-short" | "mfr-long", separator?: "/" | "-") => string;
|
|
102
102
|
export declare const countryIsoToFlag: (code: string) => string;
|
|
103
103
|
export declare const removeParamKeyName: (params: any, name?: string) => any;
|
|
104
|
+
export declare const toggleProp: (tob: any, propToToggle: string) => any;
|
package/lib/cjs/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.unCheckedAll = exports.inputChecked = exports.arrayMultiChecked = exports.getPeriodDateColor = exports.getColorAccordingToDate = exports.genRandomColour = exports.formatNgbDate = exports.dateToString = exports.replaceSpacesWith = exports.replaceAllIn = exports.sesStorageGet = exports.sesStorageSet = exports.genSequenceRef = exports.removeBackSlashOccurences = exports.removeString = exports.deepClone = exports.findFirstSequenceMissing = exports.fillNumWithZero = exports.findSequencesMissing = exports.sequencesToNumbers = exports.notInSequence = exports.reformatDates = exports.currencyFormatterCfa = exports.formatToStringCfa = exports.currencyFormatter = exports.formatToString = exports.wakeUp = exports.sleep = exports.limitTo = exports.titleCase = exports.toObjectDate = exports.duplicateObjects = exports.removeDuplicateObjects = exports.getRandomColor = exports.getNbOfDaysBetweenTwoDates = exports.displayDateRangeFr = exports.calPercent = exports.percentOf = exports.genDateMinutesStep = exports.convertFrDateToEnDate = exports.convertEnDateToFr = exports.formatDateMd = exports.formatDateYm = exports.formatDateYmFirstDay = exports.formatDateYmd = exports.formatFromAndToDate = exports.formatDateYmHypen = exports.formatDateFirstDayFr = exports.formatDateYmdHypenFr = exports.formatDateYmdHypen = void 0;
|
|
7
|
-
exports.removeParamKeyName = exports.countryIsoToFlag = exports.dateFormatter = exports.monthStringName = exports.returnBool = exports.formatAmountToString = exports.reduceSum = exports.sumAmount = exports.fillEndWithZero = exports.fillStartWithZero = exports.absFromSequence = exports.returnDates = exports.displayFrDatePeriode = exports.getArrayOfRandomColor = exports.randomHslColor = exports.randomHexColor = exports.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = exports.packAndUnit = void 0;
|
|
7
|
+
exports.toggleProp = exports.removeParamKeyName = exports.countryIsoToFlag = exports.dateFormatter = exports.monthStringName = exports.returnBool = exports.formatAmountToString = exports.reduceSum = exports.sumAmount = exports.fillEndWithZero = exports.fillStartWithZero = exports.absFromSequence = exports.returnDates = exports.displayFrDatePeriode = exports.getArrayOfRandomColor = exports.randomHslColor = exports.randomHexColor = exports.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = exports.packAndUnit = void 0;
|
|
8
8
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
9
9
|
const lodash_1 = __importDefault(require("lodash"));
|
|
10
10
|
require("dayjs/locale/fr");
|
|
@@ -642,7 +642,7 @@ const dateFormatter = (date, format = "dmy", separator = "/") => {
|
|
|
642
642
|
case "mfr-long":
|
|
643
643
|
return (0, dayjs_1.default)(date).locale("fr").format("MMMM");
|
|
644
644
|
default:
|
|
645
|
-
return (0, dayjs_1.default)(date).format(`DD
|
|
645
|
+
return (0, dayjs_1.default)(date).format(`DD/MM/YYYY`);
|
|
646
646
|
// return dayjs(date).format(`YYYY${separator}MM${separator}DD`);
|
|
647
647
|
}
|
|
648
648
|
};
|
|
@@ -662,3 +662,9 @@ const removeParamKeyName = (params, name = "name") => {
|
|
|
662
662
|
return params;
|
|
663
663
|
};
|
|
664
664
|
exports.removeParamKeyName = removeParamKeyName;
|
|
665
|
+
const toggleProp = (tob, propToToggle) => {
|
|
666
|
+
const nTob = Object.assign({}, tob);
|
|
667
|
+
nTob[propToToggle] = !nTob[propToToggle];
|
|
668
|
+
return nTob;
|
|
669
|
+
};
|
|
670
|
+
exports.toggleProp = toggleProp;
|
package/lib/esm/auth.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UserNotarial } from "./models/entities/users/UserNotatial";
|
|
1
|
+
import { AuthTag, Ste, SteGrp, UserGrp, UserRole } from "./models";
|
|
3
2
|
interface AuthParam {
|
|
4
3
|
tag?: string;
|
|
5
4
|
roles?: string[];
|
|
@@ -17,5 +16,12 @@ interface AuthParam {
|
|
|
17
16
|
steNames?: string[];
|
|
18
17
|
url?: string;
|
|
19
18
|
}
|
|
20
|
-
|
|
19
|
+
type TData = {
|
|
20
|
+
tags?: AuthTag[];
|
|
21
|
+
ste: Ste;
|
|
22
|
+
role: UserRole;
|
|
23
|
+
grp: UserGrp;
|
|
24
|
+
steGrp: SteGrp;
|
|
25
|
+
};
|
|
26
|
+
declare const getAuth: <T extends TData>(authUser: T, authSte: string[], param?: AuthParam) => boolean;
|
|
21
27
|
export { AuthParam, getAuth };
|
package/lib/esm/auth.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isStaffSte } from "./user";
|
|
2
|
+
// const getAuth = <T extends TData>(authUser: User | UserNotarial, authSte: string[], param?: AuthParam) => {
|
|
2
3
|
const getAuth = (authUser, authSte, param) => {
|
|
3
4
|
var _a, _b, _c, _d, _e, _f;
|
|
4
|
-
// let auth: boolean = false;
|
|
5
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) {
|
|
@@ -12,85 +12,52 @@ const getAuth = (authUser, authSte, param) => {
|
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
/* if (param?.roles?.length) {
|
|
16
|
-
if (isStaffSte(authSte, authUser)) {
|
|
17
|
-
return param?.roles?.length ? ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase()) : false;
|
|
18
|
-
// ------ multi roles ------
|
|
19
|
-
// return param?.roles?.length ? this.checkRoles(["sadm", ...param.roles]) : false;
|
|
20
|
-
}
|
|
21
|
-
} */
|
|
22
15
|
if (((_a = param === null || param === void 0 ? void 0 : param.roles) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// return param?.roles?.length ? this.checkRoles(["sadm", ...param.roles]) : false;
|
|
27
|
-
// }
|
|
16
|
+
if (isStaffSte(authSte, authUser.ste.name) && ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase())) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
28
19
|
}
|
|
29
20
|
// ------ staff ------
|
|
30
21
|
if (param === null || param === void 0 ? void 0 : param.staff) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// return param?.roles?.length ? this.checkRoles(["sadm", ...param.roles]) : false;
|
|
37
|
-
// }
|
|
22
|
+
if (((_b = param === null || param === void 0 ? void 0 : param.staff.roles) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
|
|
23
|
+
isStaffSte(authSte, authUser.ste.name) &&
|
|
24
|
+
["sadm", ...param.roles].includes(authUser.role.code.toLowerCase())) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
38
27
|
}
|
|
39
28
|
// ------ client ------
|
|
40
29
|
if (param === null || param === void 0 ? void 0 : param.client) {
|
|
41
30
|
if (!isStaffSte(authSte, authUser.ste.name)) {
|
|
42
|
-
if (param.client.roles &&
|
|
43
|
-
|
|
31
|
+
if (param.client.roles &&
|
|
32
|
+
!param.client.steGrps &&
|
|
33
|
+
param.client.roles.length > 0 &&
|
|
34
|
+
["ceo", ...param === null || param === void 0 ? void 0 : param.client.roles].includes(authUser.role.code.toLowerCase())) {
|
|
35
|
+
return true;
|
|
44
36
|
}
|
|
45
|
-
if (!param.client.roles &&
|
|
46
|
-
|
|
37
|
+
if (!param.client.roles &&
|
|
38
|
+
param.client.steGrps &&
|
|
39
|
+
param.client.steGrps.length &&
|
|
40
|
+
param.client.steGrps.includes(authUser.ste.grp.code.toLowerCase())) {
|
|
41
|
+
return true;
|
|
47
42
|
}
|
|
48
|
-
|
|
43
|
+
if (((_c = param === null || param === void 0 ? void 0 : param.client.roles) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
49
44
|
(param === null || param === void 0 ? void 0 : param.client.steGrps.length) &&
|
|
50
45
|
["ceo", ...param === null || param === void 0 ? void 0 : param.client.roles].includes(authUser.role.code.toLowerCase()) &&
|
|
51
|
-
(param === null || param === void 0 ? void 0 : param.client.steGrps).includes(authUser.ste.grp.code.toLowerCase()))
|
|
46
|
+
(param === null || param === void 0 ? void 0 : param.client.steGrps).includes(authUser.ste.grp.code.toLowerCase())) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
52
49
|
}
|
|
53
|
-
/* const authIn = param.steGrps.includes(this.authUser.ste.grp.code.toLowerCase());
|
|
54
|
-
if (authIn) {
|
|
55
|
-
return true;
|
|
56
|
-
} */
|
|
57
50
|
}
|
|
58
51
|
// ------ ste grps ------
|
|
59
|
-
if ((_d = param === null || param === void 0 ? void 0 : param.steGrps) === null || _d === void 0 ? void 0 : _d.length) {
|
|
60
|
-
return
|
|
52
|
+
if (((_d = param === null || param === void 0 ? void 0 : param.steGrps) === null || _d === void 0 ? void 0 : _d.length) > 0 && param.steGrps.includes(authUser.ste.grp.code.toLowerCase())) {
|
|
53
|
+
return true;
|
|
61
54
|
}
|
|
62
|
-
if ((_e = param === null || param === void 0 ? void 0 : param.grps) === null || _e === void 0 ? void 0 : _e.length) {
|
|
63
|
-
return
|
|
55
|
+
if (((_e = param === null || param === void 0 ? void 0 : param.grps) === null || _e === void 0 ? void 0 : _e.length) && param.grps.includes(authUser.grp.code.toLowerCase())) {
|
|
56
|
+
return true;
|
|
64
57
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (param.client.roles && !param.client.steGrps) {
|
|
68
|
-
return param.client.roles.length ? ["ceo", ...param?.client.roles].includes(authUser.role.code.toLowerCase()) : false;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (!param.client.roles && param.client.steGrps) {
|
|
72
|
-
return param.client.steGrps.length ? param.client.steGrps.includes(authUser.ste.grp.code.toLowerCase()) : false;
|
|
73
|
-
}
|
|
74
|
-
return param?.client.roles?.length && param?.client.steGrps.length
|
|
75
|
-
? ["ceo", ...param?.client.roles].includes(authUser.role.code.toLowerCase()) &&
|
|
76
|
-
(param?.client.steGrps).includes(authUser.ste.grp.code.toLowerCase())
|
|
77
|
-
: false;
|
|
78
|
-
}
|
|
79
|
-
const authIn = (param.steGrps).includes(this.authUser.ste.grp.code.toLowerCase());
|
|
80
|
-
if(authIn) { return true}
|
|
81
|
-
} */
|
|
82
|
-
if ((_f = param === null || param === void 0 ? void 0 : param.steNames) === null || _f === void 0 ? void 0 : _f.length) {
|
|
83
|
-
return param.steNames.includes(authUser.ste.name.toLowerCase());
|
|
84
|
-
/* const authIn = (param.steGrps).includes(this.authUser.ste.grp.code.toLowerCase());
|
|
85
|
-
if(authIn) { return true} */
|
|
58
|
+
if (((_f = param === null || param === void 0 ? void 0 : param.steNames) === null || _f === void 0 ? void 0 : _f.length) > 0 && param.steNames.includes(authUser.ste.name.toLowerCase())) {
|
|
59
|
+
return true;
|
|
86
60
|
}
|
|
87
|
-
|
|
88
|
-
return this.router.url === param.url;
|
|
89
|
-
} */
|
|
90
|
-
// return false;
|
|
91
|
-
// return auth;
|
|
92
|
-
/* if(param?.steGrps?.length) {
|
|
93
|
-
auth = (param.steGrps).includes(this.authUser.ste.grp.code.toLowerCase());
|
|
94
|
-
} */
|
|
61
|
+
return false;
|
|
95
62
|
};
|
|
96
63
|
export { getAuth };
|
package/lib/esm/utils.d.ts
CHANGED
|
@@ -101,3 +101,4 @@ export declare const monthStringName: (date: string | Date, format?: "MMM" | "MM
|
|
|
101
101
|
export declare const dateFormatter: (date: Date | string, format?: "y" | "ymd" | "dmy" | "dmy-hm" | "dmyfr" | "myfr" | "mfr-short" | "mfr-long", separator?: "/" | "-") => string;
|
|
102
102
|
export declare const countryIsoToFlag: (code: string) => string;
|
|
103
103
|
export declare const removeParamKeyName: (params: any, name?: string) => any;
|
|
104
|
+
export declare const toggleProp: (tob: any, propToToggle: string) => any;
|
package/lib/esm/utils.js
CHANGED
|
@@ -561,7 +561,7 @@ export const dateFormatter = (date, format = "dmy", separator = "/") => {
|
|
|
561
561
|
case "mfr-long":
|
|
562
562
|
return dayjs(date).locale("fr").format("MMMM");
|
|
563
563
|
default:
|
|
564
|
-
return dayjs(date).format(`DD
|
|
564
|
+
return dayjs(date).format(`DD/MM/YYYY`);
|
|
565
565
|
// return dayjs(date).format(`YYYY${separator}MM${separator}DD`);
|
|
566
566
|
}
|
|
567
567
|
};
|
|
@@ -578,3 +578,8 @@ export const removeParamKeyName = (params, name = "name") => {
|
|
|
578
578
|
}
|
|
579
579
|
return params;
|
|
580
580
|
};
|
|
581
|
+
export const toggleProp = (tob, propToToggle) => {
|
|
582
|
+
const nTob = Object.assign({}, tob);
|
|
583
|
+
nTob[propToToggle] = !nTob[propToToggle];
|
|
584
|
+
return nTob;
|
|
585
|
+
};
|