@feedmepos/mf-hrm-portal 2.0.15-dev.2 → 2.0.15-dev.4
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/{AuditLogList-_iGkRjav.js → AuditLogList-DnmeTc37.js} +4 -4
- package/dist/{EmployeeList-BsauFDHA.js → EmployeeList-DxlllTty.js} +43 -43
- package/dist/{Main-CWSLq8gH.js → Main-COZvNyhk.js} +4 -4
- package/dist/{Main-DWBJw_Ta.js → Main-CeFkxIhA.js} +765 -770
- package/dist/{Main-D0eoxqEG.js → Main-D1yqf9Yq.js} +13 -14
- package/dist/{PermissionSetList-CzFf90Bv.js → PermissionSetList-Ckc-VGme.js} +5 -5
- package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CBcnIfck.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-n4_wNZbg.js} +747 -750
- package/dist/{RoleList-CsdcFHQK.js → RoleList-BDbQX9of.js} +7 -7
- package/dist/{TeamMemberList-CI24SCZz.js → TeamMemberList-DJYxuPyN.js} +324 -323
- package/dist/{TimesheetList-eD8-rA_L.js → TimesheetList-CxehedOx.js} +6 -6
- package/dist/{app-DnT6yzx7.js → app-DEA0Bhzy.js} +2222 -1394
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-L-465Ow8.js → dayjs.min-D-rfdWhu.js} +1 -1
- package/dist/{employee-DGjXlPn1.js → employee-CFnP1VvM.js} +3 -3
- package/dist/{iteration-CAxWl04o.js → iteration-S7YxnyNB.js} +1 -1
- package/dist/{lodash-VfbpRiGW.js → lodash-BdeQh1LM.js} +1 -1
- package/dist/{rule-D6eh6FDn.js → rule-DbvJ1q_w.js} +284 -285
- package/dist/style.css +1 -1
- package/dist/{timesheet-B11NLk-Z.js → timesheet-CPZSm4Qs.js} +2 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{useAppStore-BaDI6IZu.js → useAppStore-CJ6tnELc.js} +1 -1
- package/dist/{useLoading-B2CoUwmJ.js → useLoading-BuN7YL-v.js} +1 -1
- package/dist/{useReportPermissions-BfjLdcAd.js → useReportPermissions-D-GJuNg3.js} +3 -3
- package/package.json +1 -1
- package/dist/index-DOpSY75_.js +0 -827
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { g as b, b as
|
|
2
|
-
import {
|
|
1
|
+
import { g as b, b as g, q as L, s as D, d as Q, e as j } from "./iteration-S7YxnyNB.js";
|
|
2
|
+
import { e as I, A as x, p as F, h as S, C as G, d as B } from "./app-DEA0Bhzy.js";
|
|
3
3
|
import { s as H } from "./utils-BZkjJbju.js";
|
|
4
|
-
import { defineStore as
|
|
5
|
-
import { ref as
|
|
6
|
-
import { useCoreStore as
|
|
7
|
-
const
|
|
4
|
+
import { defineStore as k, storeToRefs as W } from "pinia";
|
|
5
|
+
import { ref as h, computed as N } from "vue";
|
|
6
|
+
import { useCoreStore as J } from "@feedmepos/mf-common";
|
|
7
|
+
const U = [
|
|
8
8
|
{
|
|
9
9
|
label: "",
|
|
10
10
|
subject: "order",
|
|
@@ -338,47 +338,47 @@ const B = [
|
|
|
338
338
|
inverted: !1,
|
|
339
339
|
reason: ""
|
|
340
340
|
}
|
|
341
|
-
], A = "/permission-sets",
|
|
341
|
+
], A = "/permission-sets", O = {
|
|
342
342
|
async read() {
|
|
343
|
-
return b(await
|
|
343
|
+
return b(await g().get(A));
|
|
344
344
|
},
|
|
345
345
|
async create(e) {
|
|
346
|
-
return b(await
|
|
346
|
+
return b(await g().post(A, e));
|
|
347
347
|
},
|
|
348
|
-
async update(e,
|
|
349
|
-
return b(await
|
|
348
|
+
async update(e, n) {
|
|
349
|
+
return b(await g().put(`${A}/${e}`, n));
|
|
350
350
|
},
|
|
351
351
|
async delete(e) {
|
|
352
|
-
return b(await
|
|
352
|
+
return b(await g().delete(`${A}/${e}`));
|
|
353
353
|
}
|
|
354
|
-
}, Y =
|
|
355
|
-
const { currentBusiness: e } =
|
|
354
|
+
}, Y = k("permissionSet", () => {
|
|
355
|
+
const { currentBusiness: e } = J(), n = h([]), t = h(null);
|
|
356
356
|
async function o() {
|
|
357
357
|
var l;
|
|
358
|
-
const
|
|
359
|
-
if (t.value ===
|
|
360
|
-
const
|
|
361
|
-
|
|
358
|
+
const a = ((l = e.value) == null ? void 0 : l._id) ?? null;
|
|
359
|
+
if (t.value === a) return;
|
|
360
|
+
const u = await O.read();
|
|
361
|
+
n.value = r(u), t.value = a;
|
|
362
362
|
}
|
|
363
|
-
async function i(
|
|
364
|
-
const
|
|
365
|
-
|
|
363
|
+
async function i(a) {
|
|
364
|
+
const u = await O.create(a);
|
|
365
|
+
n.value = r([...n.value, u]);
|
|
366
366
|
}
|
|
367
|
-
async function
|
|
368
|
-
const l = await
|
|
369
|
-
|
|
367
|
+
async function s(a, u) {
|
|
368
|
+
const l = await O.update(a, u);
|
|
369
|
+
n.value = r(n.value.map((d) => d.id === a ? l : d));
|
|
370
370
|
}
|
|
371
|
-
async function c(
|
|
372
|
-
await
|
|
371
|
+
async function c(a) {
|
|
372
|
+
await O.delete(a), n.value = r(n.value.filter((u) => u.id !== a));
|
|
373
373
|
}
|
|
374
|
-
function a
|
|
375
|
-
return
|
|
374
|
+
function r(a) {
|
|
375
|
+
return a.sort((u, l) => u.name.localeCompare(l.name));
|
|
376
376
|
}
|
|
377
377
|
return {
|
|
378
|
-
permissionSets:
|
|
378
|
+
permissionSets: n,
|
|
379
379
|
readPermissionSets: o,
|
|
380
380
|
createPermissionSet: i,
|
|
381
|
-
updatePermissionSet:
|
|
381
|
+
updatePermissionSet: s,
|
|
382
382
|
deletePermissionSet: c
|
|
383
383
|
};
|
|
384
384
|
}), Z = () => {
|
|
@@ -389,77 +389,77 @@ const B = [
|
|
|
389
389
|
};
|
|
390
390
|
};
|
|
391
391
|
function V(e) {
|
|
392
|
-
const
|
|
393
|
-
var
|
|
394
|
-
const
|
|
392
|
+
const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), o = (i, s, c) => {
|
|
393
|
+
var r, a;
|
|
394
|
+
const u = `${s.subject}::${JSON.stringify([...s.actions].sort())}`, l = i.get(u);
|
|
395
395
|
if (!l) {
|
|
396
|
-
i.set(
|
|
396
|
+
i.set(u, { ...s, setNames: [c.name], setId: c._id });
|
|
397
397
|
return;
|
|
398
398
|
}
|
|
399
|
-
if (l.setNames.push(c.name), l.conditions &&
|
|
400
|
-
const d = typeof l.conditions == "string" ? JSON.parse(l.conditions) : l.conditions,
|
|
401
|
-
for (const m in
|
|
402
|
-
(
|
|
399
|
+
if (l.setNames.push(c.name), l.conditions && s.conditions) {
|
|
400
|
+
const d = typeof l.conditions == "string" ? JSON.parse(l.conditions) : l.conditions, p = typeof s.conditions == "string" ? JSON.parse(s.conditions) : s.conditions;
|
|
401
|
+
for (const m in p)
|
|
402
|
+
(r = d[m]) != null && r.$in && (a = p[m]) != null && a.$in ? d[m].$in = Array.from(/* @__PURE__ */ new Set([...d[m].$in, ...p[m].$in])) : d[m] || (d[m] = p[m]);
|
|
403
403
|
l.conditions = JSON.stringify(d);
|
|
404
404
|
}
|
|
405
405
|
};
|
|
406
406
|
for (const i of e)
|
|
407
|
-
for (const
|
|
408
|
-
o(
|
|
409
|
-
return [...Array.from(
|
|
407
|
+
for (const s of i.permissions)
|
|
408
|
+
o(s.inverted ? t : n, s, i);
|
|
409
|
+
return [...Array.from(n.values()), ...Array.from(t.values())];
|
|
410
410
|
}
|
|
411
|
-
function
|
|
412
|
-
return `${e}::${[...
|
|
411
|
+
function T(e, n) {
|
|
412
|
+
return `${e}::${[...n].sort().join(",")}`;
|
|
413
413
|
}
|
|
414
|
-
function z(e,
|
|
415
|
-
const t = [...e], o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(),
|
|
416
|
-
for (const
|
|
417
|
-
const
|
|
418
|
-
o.add(
|
|
414
|
+
function z(e, n) {
|
|
415
|
+
const t = [...e], o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
416
|
+
for (const r of e) {
|
|
417
|
+
const a = I(r.subject);
|
|
418
|
+
o.add(T(a, r.actions)), r.inverted && r.actions.includes("manage") && i.add(`set_${a}`), !r.inverted && r.actions.includes("manage") && s.add(a);
|
|
419
419
|
}
|
|
420
420
|
const c = [...e];
|
|
421
421
|
for (; c.length > 0; ) {
|
|
422
|
-
const
|
|
423
|
-
if (!
|
|
424
|
-
i.add(
|
|
425
|
-
const l = q(
|
|
426
|
-
|
|
427
|
-
const d = [...l, `${
|
|
428
|
-
for (const
|
|
429
|
-
const m = I(
|
|
430
|
-
o.has(
|
|
431
|
-
...
|
|
422
|
+
const r = c.shift(), a = `set_${I(r.subject)}`, u = n[a];
|
|
423
|
+
if (!u || i.has(a) || !r.actions.includes("manage") || r.inverted) continue;
|
|
424
|
+
i.add(a);
|
|
425
|
+
const l = q(r);
|
|
426
|
+
r.source && !r.source.trace && (r.source = { ...r.source, trace: l });
|
|
427
|
+
const d = [...l, `${u.name} (system)`];
|
|
428
|
+
for (const p of u.permissions ?? []) {
|
|
429
|
+
const m = I(p.subject), f = T(m, p.actions);
|
|
430
|
+
o.has(f) || s.has(m) || (o.add(f), t.push({
|
|
431
|
+
...p,
|
|
432
432
|
// FdoPermissionRule.fields is string[] | null; RawRule expects string[] | undefined
|
|
433
|
-
fields:
|
|
433
|
+
fields: p.fields ?? void 0,
|
|
434
434
|
source: {
|
|
435
435
|
type: "systemPermissionSet",
|
|
436
|
-
permissionSetId:
|
|
437
|
-
permissionSetName:
|
|
436
|
+
permissionSetId: u.key,
|
|
437
|
+
permissionSetName: u.name,
|
|
438
438
|
trace: d
|
|
439
439
|
}
|
|
440
440
|
}));
|
|
441
441
|
}
|
|
442
|
-
for (const
|
|
443
|
-
const m = I(
|
|
442
|
+
for (const p of u.permissionSets ?? []) {
|
|
443
|
+
const m = I(p), f = T(m, ["manage"]), v = {
|
|
444
444
|
subject: m,
|
|
445
445
|
actions: ["manage"],
|
|
446
446
|
source: {
|
|
447
447
|
type: "systemPermissionSet",
|
|
448
|
-
permissionSetId:
|
|
449
|
-
permissionSetName:
|
|
448
|
+
permissionSetId: u.key,
|
|
449
|
+
permissionSetName: u.name,
|
|
450
450
|
trace: d
|
|
451
451
|
}
|
|
452
452
|
};
|
|
453
|
-
o.has(
|
|
453
|
+
o.has(f) || (o.add(f), t.push(v)), c.push(v);
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
|
-
return [...t.filter((
|
|
456
|
+
return [...t.filter((r) => !r.inverted), ...t.filter((r) => r.inverted)];
|
|
457
457
|
}
|
|
458
458
|
function q(e) {
|
|
459
459
|
if (!e.source) return [];
|
|
460
|
-
const { type:
|
|
460
|
+
const { type: n, trace: t, permissionSetName: o } = e.source;
|
|
461
461
|
if (t && t.length > 0) return t;
|
|
462
|
-
switch (
|
|
462
|
+
switch (n) {
|
|
463
463
|
case "permissionSet":
|
|
464
464
|
return o ? [o] : [];
|
|
465
465
|
case "custom":
|
|
@@ -468,258 +468,255 @@ function q(e) {
|
|
|
468
468
|
return [];
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
|
-
function K(e,
|
|
471
|
+
function K(e, n, t = /* @__PURE__ */ new Set()) {
|
|
472
472
|
var i;
|
|
473
473
|
const o = [];
|
|
474
|
-
for (const
|
|
475
|
-
if (t.has(
|
|
476
|
-
t.add(
|
|
477
|
-
const c =
|
|
478
|
-
c && (o.push(c), (i = c.permissionSetIds) != null && i.length && o.push(...K(c.permissionSetIds,
|
|
474
|
+
for (const s of e) {
|
|
475
|
+
if (t.has(s)) continue;
|
|
476
|
+
t.add(s);
|
|
477
|
+
const c = n.find((r) => r.id === s);
|
|
478
|
+
c && (o.push(c), (i = c.permissionSetIds) != null && i.length && o.push(...K(c.permissionSetIds, n, t)));
|
|
479
479
|
}
|
|
480
480
|
return o;
|
|
481
481
|
}
|
|
482
482
|
function je(e) {
|
|
483
|
-
const
|
|
484
|
-
({ setNames: i, setId:
|
|
485
|
-
), t =
|
|
483
|
+
const n = V(e).map(
|
|
484
|
+
({ setNames: i, setId: s, ...c }) => c
|
|
485
|
+
), t = n.filter((i) => !i.inverted), o = n.filter((i) => i.inverted);
|
|
486
486
|
return M(t, o);
|
|
487
487
|
}
|
|
488
|
-
function he(e,
|
|
488
|
+
function he(e, n, t) {
|
|
489
489
|
const o = /* @__PURE__ */ new Map();
|
|
490
490
|
return e.forEach(
|
|
491
|
-
({ name: i, permissions:
|
|
492
|
-
var
|
|
493
|
-
const
|
|
494
|
-
(
|
|
491
|
+
({ name: i, permissions: s }) => s.forEach(({ conditions: c, actions: r }) => {
|
|
492
|
+
var u, l;
|
|
493
|
+
const a = JSON.parse(c || "{}");
|
|
494
|
+
(u = a[n]) != null && u.$in ? (l = a[n]) == null || l.$in.forEach(
|
|
495
495
|
(d) => (o.get(d) ?? o.set(d, /* @__PURE__ */ new Set()).get(d)).add(i)
|
|
496
|
-
) :
|
|
496
|
+
) : r[0] === "manage" && t.forEach((d) => {
|
|
497
497
|
(o.get(d) ?? o.set(d, /* @__PURE__ */ new Set()).get(d)).add(i);
|
|
498
498
|
});
|
|
499
499
|
})
|
|
500
|
-
), [...o].map(([i,
|
|
500
|
+
), [...o].map(([i, s]) => ({
|
|
501
501
|
id: i,
|
|
502
|
-
setNames: [...
|
|
502
|
+
setNames: [...s]
|
|
503
503
|
}));
|
|
504
504
|
}
|
|
505
|
-
function ye(e,
|
|
506
|
-
const t = (
|
|
507
|
-
const
|
|
508
|
-
if (
|
|
509
|
-
if (
|
|
505
|
+
function ye(e, n) {
|
|
506
|
+
const t = (r, a) => {
|
|
507
|
+
const u = { ...r }, l = JSON.parse(u.conditions || "{}");
|
|
508
|
+
if (a)
|
|
509
|
+
if (a.length > 0) {
|
|
510
510
|
const d = Object.keys(l)[0];
|
|
511
|
-
l[d].$in =
|
|
511
|
+
l[d].$in = a;
|
|
512
512
|
} else
|
|
513
|
-
delete
|
|
513
|
+
delete u.conditions;
|
|
514
514
|
return {
|
|
515
|
-
...
|
|
515
|
+
...u,
|
|
516
516
|
inverted: !0,
|
|
517
|
-
...
|
|
517
|
+
...u.conditions && { conditions: JSON.stringify(l) }
|
|
518
518
|
};
|
|
519
|
-
}, o = new Map(e.map((
|
|
520
|
-
for (const
|
|
521
|
-
const
|
|
522
|
-
if (
|
|
523
|
-
if (
|
|
524
|
-
const l = JSON.parse(
|
|
525
|
-
(
|
|
519
|
+
}, o = new Map(e.map((r) => [r.subject, r])), i = new Map(n.map((r) => [r.subject, r])), s = [], c = /* @__PURE__ */ new Set([...o.keys(), ...i.keys()]);
|
|
520
|
+
for (const r of c) {
|
|
521
|
+
const a = o.get(r), u = i.get(r);
|
|
522
|
+
if (a && u) {
|
|
523
|
+
if (a.conditions && u.conditions) {
|
|
524
|
+
const l = JSON.parse(a.conditions), d = JSON.parse(u.conditions), p = Object.keys(l)[0], m = l[p].$in.filter(
|
|
525
|
+
(v) => !d[p].$in.includes(v)
|
|
526
526
|
);
|
|
527
|
-
m.length > 0 &&
|
|
528
|
-
(
|
|
529
|
-
).length > 0 &&
|
|
530
|
-
} else if (!
|
|
531
|
-
|
|
532
|
-
else if (!
|
|
533
|
-
const l = new Set(
|
|
534
|
-
if (
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
...
|
|
538
|
-
actions:
|
|
527
|
+
m.length > 0 && s.push(t(a, m)), d[p].$in.filter(
|
|
528
|
+
(v) => !l[p].$in.includes(v)
|
|
529
|
+
).length > 0 && s.push(u);
|
|
530
|
+
} else if (!a.conditions && u.conditions)
|
|
531
|
+
s.push(u);
|
|
532
|
+
else if (!a.conditions && !u.conditions) {
|
|
533
|
+
const l = new Set(a.actions), d = new Set(u.actions), p = u.actions.some((f) => !l.has(f)), m = a.actions.filter((f) => !d.has(f));
|
|
534
|
+
if (p) {
|
|
535
|
+
const f = u.actions.filter((v) => !l.has(v));
|
|
536
|
+
s.push({
|
|
537
|
+
...u,
|
|
538
|
+
actions: f
|
|
539
539
|
});
|
|
540
540
|
}
|
|
541
|
-
m.length > 0 &&
|
|
542
|
-
...
|
|
541
|
+
m.length > 0 && s.push({
|
|
542
|
+
...a,
|
|
543
543
|
actions: m,
|
|
544
544
|
inverted: !0
|
|
545
545
|
});
|
|
546
546
|
}
|
|
547
547
|
continue;
|
|
548
548
|
}
|
|
549
|
-
if (
|
|
550
|
-
|
|
549
|
+
if (a) {
|
|
550
|
+
s.push(
|
|
551
551
|
t(
|
|
552
|
-
|
|
552
|
+
a,
|
|
553
553
|
// If base has conditions, set diffIds to empty array, disallow all access to collection
|
|
554
554
|
// otherwise, invert directly
|
|
555
|
-
|
|
555
|
+
a.conditions && []
|
|
556
556
|
)
|
|
557
557
|
);
|
|
558
558
|
continue;
|
|
559
559
|
}
|
|
560
|
-
|
|
560
|
+
u && s.push(u);
|
|
561
561
|
}
|
|
562
|
-
return
|
|
562
|
+
return s;
|
|
563
563
|
}
|
|
564
564
|
function Pe(e) {
|
|
565
|
-
const
|
|
565
|
+
const n = z(
|
|
566
566
|
e,
|
|
567
|
-
|
|
567
|
+
x
|
|
568
568
|
), t = new Set(
|
|
569
|
-
|
|
570
|
-
var
|
|
571
|
-
return ((
|
|
569
|
+
n.filter((i) => {
|
|
570
|
+
var s;
|
|
571
|
+
return ((s = i.source) == null ? void 0 : s.type) === "systemPermissionSet" && !i.inverted;
|
|
572
572
|
}).map((i) => i.subject)
|
|
573
573
|
), o = new Set(
|
|
574
|
-
|
|
574
|
+
n.filter(
|
|
575
575
|
(i) => {
|
|
576
|
-
var
|
|
577
|
-
return ((
|
|
576
|
+
var s;
|
|
577
|
+
return ((s = i.source) == null ? void 0 : s.type) === "systemPermissionSet" && !i.inverted && i.actions.includes("manage");
|
|
578
578
|
}
|
|
579
579
|
).map((i) => i.subject)
|
|
580
580
|
);
|
|
581
581
|
return e.filter((i) => i.inverted ? !(t.has(i.subject) && !o.has(i.subject)) : !t.has(i.subject));
|
|
582
582
|
}
|
|
583
583
|
const ee = "business::report::";
|
|
584
|
-
function we(e,
|
|
584
|
+
function we(e, n) {
|
|
585
585
|
const t = [], o = e.filter((i) => {
|
|
586
|
-
const
|
|
587
|
-
return !
|
|
586
|
+
const s = i.subject;
|
|
587
|
+
return !s.startsWith(ee) || n.has(s) ? !0 : (t.push(s), !1);
|
|
588
588
|
});
|
|
589
589
|
return t.length > 0 && console.warn("[filterStalePermissions] dropped stale report permissions:", t), o;
|
|
590
590
|
}
|
|
591
|
-
const
|
|
592
|
-
function $e(e,
|
|
591
|
+
const ne = "business::report::reports::", se = "business::report::allDefaultReports", te = "business::report::allCustomReports";
|
|
592
|
+
function $e(e, n) {
|
|
593
593
|
const t = e.find(
|
|
594
|
-
(c) => !c.inverted && c.subject ===
|
|
594
|
+
(c) => !c.inverted && c.subject === se
|
|
595
595
|
), o = e.find(
|
|
596
596
|
(c) => !c.inverted && c.subject === te
|
|
597
597
|
);
|
|
598
598
|
if (!t && !o) return e;
|
|
599
|
-
const i = t ? new Set(t.actions) : null,
|
|
600
|
-
return e.reduce((c,
|
|
601
|
-
if (
|
|
602
|
-
return c.push(
|
|
603
|
-
const
|
|
604
|
-
if (!
|
|
605
|
-
return c.push(
|
|
606
|
-
const l =
|
|
599
|
+
const i = t ? new Set(t.actions) : null, s = o ? new Set(o.actions) : null;
|
|
600
|
+
return e.reduce((c, r) => {
|
|
601
|
+
if (r.inverted)
|
|
602
|
+
return c.push(r), c;
|
|
603
|
+
const a = r.subject;
|
|
604
|
+
if (!a.startsWith(ne))
|
|
605
|
+
return c.push(r), c;
|
|
606
|
+
const l = n.has(a) ? i : s;
|
|
607
607
|
if (!l)
|
|
608
|
-
return c.push(
|
|
608
|
+
return c.push(r), c;
|
|
609
609
|
if (l.has("manage")) return c;
|
|
610
|
-
const d = new Set(
|
|
610
|
+
const d = new Set(r.actions), p = d.has("manage");
|
|
611
611
|
let m = !1;
|
|
612
|
-
for (const
|
|
613
|
-
|
|
614
|
-
return
|
|
612
|
+
for (const f of l)
|
|
613
|
+
f !== "manage" && d.delete(f) && (m = !0);
|
|
614
|
+
return p && m && d.delete("manage"), d.size === 0 || c.push({ ...r, actions: Array.from(d) }), c;
|
|
615
615
|
}, []);
|
|
616
616
|
}
|
|
617
|
-
function M(e,
|
|
617
|
+
function M(e, n) {
|
|
618
618
|
var o, i;
|
|
619
|
-
const t = new Map(e.map((
|
|
620
|
-
for (const
|
|
621
|
-
if (
|
|
622
|
-
const
|
|
623
|
-
if (
|
|
624
|
-
if (
|
|
625
|
-
const
|
|
626
|
-
m.length > 0 ? t.set(
|
|
627
|
-
...
|
|
619
|
+
const t = new Map(e.map((s) => [s.subject, s]));
|
|
620
|
+
for (const s of n) {
|
|
621
|
+
if (s.inverted) {
|
|
622
|
+
const r = t.get(s.subject);
|
|
623
|
+
if (s.conditions) {
|
|
624
|
+
if (r != null && r.conditions) {
|
|
625
|
+
const a = JSON.parse(r.conditions), u = JSON.parse(s.conditions), l = Object.keys(u)[0], d = ((o = u[l]) == null ? void 0 : o.$in) ?? [], m = (((i = a[l]) == null ? void 0 : i.$in) ?? []).filter((f) => !d.includes(f));
|
|
626
|
+
m.length > 0 ? t.set(s.subject, {
|
|
627
|
+
...r,
|
|
628
628
|
conditions: JSON.stringify({ [l]: { $in: m } })
|
|
629
|
-
}) : t.delete(
|
|
629
|
+
}) : t.delete(s.subject);
|
|
630
630
|
} else
|
|
631
|
-
t.delete(
|
|
631
|
+
t.delete(s.subject);
|
|
632
632
|
continue;
|
|
633
633
|
}
|
|
634
|
-
if (
|
|
635
|
-
const
|
|
636
|
-
|
|
634
|
+
if (r) {
|
|
635
|
+
const a = new Set(s.actions), u = r.actions.filter((l) => !a.has(l));
|
|
636
|
+
u.length > 0 ? t.set(s.subject, { ...r, actions: u }) : t.delete(s.subject);
|
|
637
637
|
continue;
|
|
638
638
|
}
|
|
639
639
|
continue;
|
|
640
640
|
}
|
|
641
|
-
if (
|
|
642
|
-
t.set(
|
|
641
|
+
if (s.conditions) {
|
|
642
|
+
t.set(s.subject, s);
|
|
643
643
|
continue;
|
|
644
644
|
}
|
|
645
|
-
const c = t.get(
|
|
645
|
+
const c = t.get(s.subject);
|
|
646
646
|
if (c) {
|
|
647
|
-
const
|
|
647
|
+
const r = [
|
|
648
648
|
.../* @__PURE__ */ new Set([
|
|
649
649
|
...c.actions,
|
|
650
|
-
...
|
|
650
|
+
...s.actions
|
|
651
651
|
])
|
|
652
652
|
];
|
|
653
|
-
t.set(
|
|
653
|
+
t.set(s.subject, { ...c, actions: r });
|
|
654
654
|
} else
|
|
655
|
-
t.set(
|
|
655
|
+
t.set(s.subject, s);
|
|
656
656
|
}
|
|
657
657
|
return Array.from(t.values());
|
|
658
658
|
}
|
|
659
|
-
function oe(e,
|
|
660
|
-
const t = M(e,
|
|
661
|
-
(
|
|
659
|
+
function oe(e, n) {
|
|
660
|
+
const t = M(e, n), o = new Set(e.map((s) => s.subject)), i = n.filter(
|
|
661
|
+
(s) => s.inverted && !o.has(s.subject)
|
|
662
662
|
);
|
|
663
663
|
return [...t, ...i];
|
|
664
664
|
}
|
|
665
665
|
const y = "/permission-assignments", P = {
|
|
666
666
|
async readAll() {
|
|
667
|
-
return b(await
|
|
667
|
+
return b(await g().get(y));
|
|
668
668
|
},
|
|
669
669
|
async readByUserId(e) {
|
|
670
|
-
return b(await
|
|
670
|
+
return b(await g().get(`${y}/user/${e}`));
|
|
671
671
|
},
|
|
672
672
|
async readById(e) {
|
|
673
|
-
return b(await
|
|
673
|
+
return b(await g().get(`${y}/${e}`));
|
|
674
674
|
},
|
|
675
675
|
async create(e) {
|
|
676
|
-
return b(await
|
|
676
|
+
return b(await g().post(y, e));
|
|
677
677
|
},
|
|
678
|
-
async update(e,
|
|
679
|
-
return b(await
|
|
678
|
+
async update(e, n) {
|
|
679
|
+
return b(await g().put(`${y}/${e}`, n));
|
|
680
680
|
},
|
|
681
681
|
async delete(e) {
|
|
682
|
-
return b(await
|
|
682
|
+
return b(await g().delete(`${y}/${e}`));
|
|
683
683
|
},
|
|
684
|
-
async addReportManagePermission(e,
|
|
684
|
+
async addReportManagePermission(e, n) {
|
|
685
685
|
return b(
|
|
686
|
-
await
|
|
686
|
+
await g().post("/my-permissions/report-manage", { permissionKey: e, label: n })
|
|
687
687
|
);
|
|
688
688
|
}
|
|
689
|
-
}, ie =
|
|
690
|
-
const
|
|
691
|
-
async function
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
if (t.value === r) return;
|
|
695
|
-
const l = await P.readAll();
|
|
696
|
-
s.value = l, t.value = r;
|
|
689
|
+
}, ie = k("permissionAssignment", () => {
|
|
690
|
+
const e = h([]);
|
|
691
|
+
async function n() {
|
|
692
|
+
const r = await P.readAll();
|
|
693
|
+
e.value = r;
|
|
697
694
|
}
|
|
698
|
-
async function
|
|
695
|
+
async function t(r) {
|
|
699
696
|
return await P.readByUserId(r);
|
|
700
697
|
}
|
|
701
|
-
async function
|
|
702
|
-
const
|
|
703
|
-
|
|
698
|
+
async function o(r) {
|
|
699
|
+
const a = await P.create(r);
|
|
700
|
+
e.value = [...e.value, a];
|
|
704
701
|
}
|
|
705
|
-
async function
|
|
706
|
-
const
|
|
707
|
-
|
|
702
|
+
async function i(r, a) {
|
|
703
|
+
const u = await P.update(r, a);
|
|
704
|
+
e.value = e.value.map((l) => l.id === r ? u : l);
|
|
708
705
|
}
|
|
709
|
-
async function
|
|
710
|
-
await P.delete(r),
|
|
706
|
+
async function s(r) {
|
|
707
|
+
await P.delete(r), e.value = e.value.filter((a) => a.id !== r);
|
|
711
708
|
}
|
|
712
|
-
function
|
|
713
|
-
return
|
|
709
|
+
function c(r) {
|
|
710
|
+
return e.value.find((a) => a.userId === r);
|
|
714
711
|
}
|
|
715
712
|
return {
|
|
716
|
-
permissionAssignments:
|
|
717
|
-
readPermissionAssignments:
|
|
718
|
-
readPermissionAssignmentByUserId:
|
|
719
|
-
createPermissionAssignment:
|
|
720
|
-
updatePermissionAssignment:
|
|
721
|
-
deletePermissionAssignment:
|
|
722
|
-
getPermissionAssignmentByUserId:
|
|
713
|
+
permissionAssignments: e,
|
|
714
|
+
readPermissionAssignments: n,
|
|
715
|
+
readPermissionAssignmentByUserId: t,
|
|
716
|
+
createPermissionAssignment: o,
|
|
717
|
+
updatePermissionAssignment: i,
|
|
718
|
+
deletePermissionAssignment: s,
|
|
719
|
+
getPermissionAssignmentByUserId: c
|
|
723
720
|
};
|
|
724
721
|
}), re = () => {
|
|
725
722
|
const e = ie();
|
|
@@ -740,27 +737,27 @@ const y = "/permission-assignments", P = {
|
|
|
740
737
|
)
|
|
741
738
|
);
|
|
742
739
|
}
|
|
743
|
-
},
|
|
740
|
+
}, _ = h([]), E = h(!1), w = h(!1), $ = h(null);
|
|
744
741
|
function ce() {
|
|
745
|
-
const e =
|
|
746
|
-
async function
|
|
742
|
+
const e = J();
|
|
743
|
+
async function n() {
|
|
747
744
|
var i;
|
|
748
745
|
const o = (i = e.currentBusiness.value) == null ? void 0 : i.id;
|
|
749
|
-
if (o && ($.value !== o && (
|
|
746
|
+
if (o && ($.value !== o && (_.value = [], E.value = !1, w.value = !1, $.value = o), !(E.value || w.value))) {
|
|
750
747
|
w.value = !0;
|
|
751
748
|
try {
|
|
752
|
-
const
|
|
749
|
+
const s = await ae.fetchReportPermissionsForPortal(o);
|
|
753
750
|
if ($.value !== o) return;
|
|
754
|
-
|
|
755
|
-
} catch (
|
|
751
|
+
_.value = s, E.value = !0;
|
|
752
|
+
} catch (s) {
|
|
756
753
|
if ($.value !== o) return;
|
|
757
|
-
console.warn("Failed to fetch custom report permissions:",
|
|
754
|
+
console.warn("Failed to fetch custom report permissions:", s), _.value = [];
|
|
758
755
|
} finally {
|
|
759
756
|
$.value === o && (w.value = !1);
|
|
760
757
|
}
|
|
761
758
|
}
|
|
762
759
|
}
|
|
763
|
-
const t =
|
|
760
|
+
const t = N(() => _.value.map(
|
|
764
761
|
(o) => o.isDefault ? {
|
|
765
762
|
label: o.name,
|
|
766
763
|
subject: `business::report::reports::${o.permissionKey}`,
|
|
@@ -780,25 +777,25 @@ function ce() {
|
|
|
780
777
|
}
|
|
781
778
|
));
|
|
782
779
|
return {
|
|
783
|
-
fetchCustomReportPermissions:
|
|
780
|
+
fetchCustomReportPermissions: n,
|
|
784
781
|
customReportPermissions: t,
|
|
785
|
-
isLoading:
|
|
786
|
-
isLoaded:
|
|
782
|
+
isLoading: N(() => w.value),
|
|
783
|
+
isLoaded: N(() => E.value)
|
|
787
784
|
};
|
|
788
785
|
}
|
|
789
786
|
function R(e) {
|
|
790
|
-
const
|
|
787
|
+
const n = J(), t = Z(), o = re(), i = n.restaurants, { customReportPermissions: s } = ce(), c = o.getPermissionAssignmentByUserId(e.id), r = K(
|
|
791
788
|
(c == null ? void 0 : c.permissionSetIds) ?? [],
|
|
792
789
|
t.permissionSets.value
|
|
793
|
-
),
|
|
794
|
-
({ setNames:
|
|
795
|
-
),
|
|
796
|
-
...
|
|
797
|
-
subject: I(
|
|
798
|
-
})), d = M(
|
|
799
|
-
oe(
|
|
800
|
-
|
|
801
|
-
).filter((
|
|
790
|
+
), a = V(r).map(
|
|
791
|
+
({ setNames: f, ...v }) => v
|
|
792
|
+
), u = c == null ? void 0 : c.customPermissions, l = u ?? e.permissions.map((f) => ({
|
|
793
|
+
...f,
|
|
794
|
+
subject: I(f.subject)
|
|
795
|
+
})), d = M(a, l), p = z(
|
|
796
|
+
oe(a, l),
|
|
797
|
+
x
|
|
798
|
+
).filter((f) => !f.inverted), m = le(p) || i.value.map((f) => f._id);
|
|
802
799
|
return {
|
|
803
800
|
doc: e,
|
|
804
801
|
id: e.id,
|
|
@@ -807,14 +804,14 @@ function R(e) {
|
|
|
807
804
|
email: e.email,
|
|
808
805
|
restaurants: D(
|
|
809
806
|
m.map(
|
|
810
|
-
(
|
|
811
|
-
var
|
|
812
|
-
return ((
|
|
807
|
+
(f) => {
|
|
808
|
+
var v;
|
|
809
|
+
return ((v = i.value.find((X) => X._id === f)) == null ? void 0 : v.profile.name) ?? "";
|
|
813
810
|
}
|
|
814
811
|
)
|
|
815
812
|
),
|
|
816
813
|
managableRestaurantIds: m,
|
|
817
|
-
permissionLabels: me(
|
|
814
|
+
permissionLabels: me(p, s.value),
|
|
818
815
|
permissions: d
|
|
819
816
|
};
|
|
820
817
|
}
|
|
@@ -823,13 +820,13 @@ const ue = Object.freeze(
|
|
|
823
820
|
), Re = {
|
|
824
821
|
async readTeamMembers() {
|
|
825
822
|
return b(
|
|
826
|
-
await
|
|
823
|
+
await g().get("/portal-users")
|
|
827
824
|
).map(R);
|
|
828
825
|
},
|
|
829
826
|
async readTeamMembersPage(e) {
|
|
830
827
|
var t, o;
|
|
831
|
-
const
|
|
832
|
-
await
|
|
828
|
+
const n = b(
|
|
829
|
+
await g().get("/portal-users/paged", {
|
|
833
830
|
params: {
|
|
834
831
|
limit: e.limit,
|
|
835
832
|
offset: e.offset,
|
|
@@ -840,62 +837,62 @@ const ue = Object.freeze(
|
|
|
840
837
|
})
|
|
841
838
|
);
|
|
842
839
|
return {
|
|
843
|
-
items:
|
|
844
|
-
total:
|
|
840
|
+
items: n.items.map(R),
|
|
841
|
+
total: n.total
|
|
845
842
|
};
|
|
846
843
|
},
|
|
847
844
|
async readTeamMember(e) {
|
|
848
845
|
return R(
|
|
849
|
-
b(await
|
|
846
|
+
b(await g().get(`/portal-users/${e}`))
|
|
850
847
|
);
|
|
851
848
|
},
|
|
852
849
|
async createTeamMember(e) {
|
|
853
850
|
return R(
|
|
854
|
-
b(await
|
|
851
|
+
b(await g().post("/portal-users", e))
|
|
855
852
|
);
|
|
856
853
|
},
|
|
857
|
-
async updateTeamMember(e,
|
|
854
|
+
async updateTeamMember(e, n) {
|
|
858
855
|
return R(
|
|
859
|
-
b(await
|
|
856
|
+
b(await g().put(`/portal-users/${e}`, n))
|
|
860
857
|
);
|
|
861
858
|
},
|
|
862
859
|
async deleteTeamMember(e) {
|
|
863
|
-
return b(await
|
|
860
|
+
return b(await g().delete(`/portal-users/${e}`));
|
|
864
861
|
},
|
|
865
862
|
async readTeamMemberPosUserIds() {
|
|
866
|
-
return b(await
|
|
863
|
+
return b(await g().get("/portal-users")).map((n) => n.posUserId);
|
|
867
864
|
}
|
|
868
865
|
};
|
|
869
|
-
function Ie(e,
|
|
866
|
+
function Ie(e, n, t) {
|
|
870
867
|
if (e.some((c) => c.subject === "all")) return "All";
|
|
871
|
-
const o = (t ??
|
|
872
|
-
(c) => c.subject ===
|
|
873
|
-
), i = new Set(o.map((c) =>
|
|
874
|
-
return
|
|
868
|
+
const o = (t ?? U).filter(
|
|
869
|
+
(c) => c.subject === n
|
|
870
|
+
), i = new Set(o.map((c) => C(c).value)), s = e.filter((c) => c.subject === n).filter((c) => i.has(C(c).value));
|
|
871
|
+
return s.length === o.length ? "All" : s.length === 0 ? "-" : `${s.length} permission allow`;
|
|
875
872
|
}
|
|
876
|
-
function
|
|
877
|
-
const
|
|
873
|
+
function C(e) {
|
|
874
|
+
const n = Q(e), t = n.subject;
|
|
878
875
|
return {
|
|
879
|
-
...
|
|
876
|
+
...n,
|
|
880
877
|
get conditions() {
|
|
881
|
-
return typeof
|
|
878
|
+
return typeof n.conditions == "string" ? JSON.parse(n.conditions) : n.conditions;
|
|
882
879
|
},
|
|
883
880
|
get isDiscountOperation() {
|
|
884
881
|
var o;
|
|
885
|
-
return t ===
|
|
882
|
+
return t === j.F_RULE_SUBJECT.enum.order && ((o = this.conditions) == null ? void 0 : o.operation) === j.F_RULE_ORDER_OPERATION.enum.discount;
|
|
886
883
|
},
|
|
887
884
|
get isOrderOperation() {
|
|
888
|
-
return t ===
|
|
885
|
+
return t === j.F_RULE_SUBJECT.enum.order;
|
|
889
886
|
},
|
|
890
887
|
get isReportPermission() {
|
|
891
|
-
return t ===
|
|
888
|
+
return t === j.F_RULE_SUBJECT.enum.report;
|
|
892
889
|
},
|
|
893
890
|
get formatted() {
|
|
894
891
|
const o = (i) => i.endsWith("_") ? i.slice(0, i.length - 1) : i;
|
|
895
892
|
return this.isOrderOperation ? o(this.conditions.operation) : this.isReportPermission ? o(this.conditions.name) : t.toString();
|
|
896
893
|
},
|
|
897
894
|
get label() {
|
|
898
|
-
return
|
|
895
|
+
return n.label || H(this.formatted);
|
|
899
896
|
},
|
|
900
897
|
get value() {
|
|
901
898
|
return this.isOrderOperation ? `${t}:${this.conditions.operation}` : this.isReportPermission ? `${t}:${this.conditions.name}` : t.toString();
|
|
@@ -903,23 +900,23 @@ function N(e) {
|
|
|
903
900
|
};
|
|
904
901
|
}
|
|
905
902
|
function Ae(e) {
|
|
906
|
-
const
|
|
907
|
-
return
|
|
903
|
+
const n = e.map((t) => C(t)).find((t) => t.isDiscountOperation);
|
|
904
|
+
return n ? parseInt((n.conditions.adjustment.$lte * 100).toFixed(0)) : 100;
|
|
908
905
|
}
|
|
909
906
|
function le(e) {
|
|
910
|
-
const
|
|
911
|
-
(t) => t.subject ===
|
|
907
|
+
const n = e.find(
|
|
908
|
+
(t) => t.subject === B.Subject.Restaurant.restaurant
|
|
912
909
|
);
|
|
913
|
-
return
|
|
914
|
-
}
|
|
915
|
-
function _e(e) {
|
|
916
|
-
return (e == null ? void 0 : e.some((s) => s.subject === "all")) ?? !1;
|
|
910
|
+
return n ? n.conditions ? JSON.parse(n.conditions).restaurantId.$in : null : [];
|
|
917
911
|
}
|
|
918
912
|
function Oe(e) {
|
|
919
|
-
|
|
920
|
-
|
|
913
|
+
return (e == null ? void 0 : e.some((n) => n.subject === "all")) ?? !1;
|
|
914
|
+
}
|
|
915
|
+
function _e(e) {
|
|
916
|
+
const n = e.find((t) => t.subject === B.Subject.Business.role);
|
|
917
|
+
return n ? n.conditions ? JSON.parse(n.conditions).roleId.$in : null : [];
|
|
921
918
|
}
|
|
922
|
-
function Ee(e,
|
|
919
|
+
function Ee(e, n) {
|
|
923
920
|
return e.map((t) => {
|
|
924
921
|
const o = de(t);
|
|
925
922
|
return {
|
|
@@ -927,35 +924,37 @@ function Ee(e, s) {
|
|
|
927
924
|
actions: o.actions,
|
|
928
925
|
conditions: {
|
|
929
926
|
...o.conditions,
|
|
930
|
-
adjustment: o.isDiscountOperation ? { $lte: parseFloat((
|
|
927
|
+
adjustment: o.isDiscountOperation ? { $lte: parseFloat((n / 100).toFixed(2)) } : void 0
|
|
931
928
|
}
|
|
932
929
|
};
|
|
933
930
|
});
|
|
934
931
|
}
|
|
935
932
|
function de(e) {
|
|
936
|
-
const [
|
|
933
|
+
const [n, t] = e.split(":");
|
|
937
934
|
let o;
|
|
938
|
-
return t ? (o =
|
|
939
|
-
(i) => i.subject ===
|
|
935
|
+
return t ? (o = U.find(
|
|
936
|
+
(i) => i.subject === n && [
|
|
940
937
|
(typeof i.conditions == "object" ? i.conditions : JSON.parse(i.conditions)).operation,
|
|
941
938
|
i.conditions.name
|
|
942
939
|
].includes(t)
|
|
943
|
-
), !o &&
|
|
940
|
+
), !o && n === j.F_RULE_SUBJECT.enum.report && (o = {
|
|
944
941
|
label: "",
|
|
945
|
-
subject:
|
|
942
|
+
subject: j.F_RULE_SUBJECT.enum.report,
|
|
946
943
|
actions: ["read"],
|
|
947
944
|
conditions: { name: t },
|
|
948
945
|
inverted: !1,
|
|
949
946
|
reason: ""
|
|
950
|
-
})) : o =
|
|
947
|
+
})) : o = U.find((i) => i.subject === n), C(o || { subject: j.F_RULE_SUBJECT.enum.order, actions: [], label: "" });
|
|
951
948
|
}
|
|
952
|
-
function me(e,
|
|
949
|
+
function me(e, n = []) {
|
|
953
950
|
return D(
|
|
954
951
|
e.reduce((t, o) => {
|
|
955
|
-
const i = ue.find(
|
|
952
|
+
const i = ue.find(
|
|
953
|
+
(s) => s.subject === o.subject && o.actions.includes("manage")
|
|
954
|
+
) || n.find((s) => s.subject === o.subject);
|
|
956
955
|
if (i) {
|
|
957
|
-
const
|
|
958
|
-
t.push(
|
|
956
|
+
const s = i.subject === B.Subject.Business.inventory_stock ? "Warehouse Management" : i.label;
|
|
957
|
+
t.push(s);
|
|
959
958
|
}
|
|
960
959
|
return t;
|
|
961
960
|
}, [])
|
|
@@ -968,12 +967,12 @@ export {
|
|
|
968
967
|
oe as b,
|
|
969
968
|
K as c,
|
|
970
969
|
ce as d,
|
|
971
|
-
|
|
970
|
+
U as e,
|
|
972
971
|
Ee as f,
|
|
973
972
|
Ae as g,
|
|
974
|
-
|
|
973
|
+
Oe as h,
|
|
975
974
|
ee as i,
|
|
976
|
-
|
|
975
|
+
_e as j,
|
|
977
976
|
we as k,
|
|
978
977
|
$e as l,
|
|
979
978
|
je as m,
|
|
@@ -981,7 +980,7 @@ export {
|
|
|
981
980
|
re as o,
|
|
982
981
|
ue as p,
|
|
983
982
|
me as q,
|
|
984
|
-
|
|
983
|
+
C as r,
|
|
985
984
|
Pe as s,
|
|
986
985
|
Re as t,
|
|
987
986
|
Z as u,
|