@feedmepos/mf-hrm-portal 1.1.3-dev → 1.1.3-dev.10

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.
Files changed (49) hide show
  1. package/dist/AuditLogList-BghaBoJj.js +436 -0
  2. package/dist/EmployeeList-C4knb1ZM.js +626 -0
  3. package/dist/{Main-DGymQNz9.js → Main-BGcdVWrj.js} +10 -9
  4. package/dist/{Main-BqhrqOzx.js → Main-DYuuBLTj.js} +28 -27
  5. package/dist/PermissionSetList-DPKmbnO4.js +323 -0
  6. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-nbk54pp5.js +3092 -0
  7. package/dist/RoleList-CWUkSfcS.js +494 -0
  8. package/dist/TeamMemberList-BDB9zWwa.js +965 -0
  9. package/dist/{TimesheetList-hgT9DrHd.js → TimesheetList-CqVVoydR.js} +25 -24
  10. package/dist/api/index.d.ts +5 -0
  11. package/dist/api/report-query/index.d.ts +5 -0
  12. package/dist/api/team/index.d.ts +2 -5
  13. package/dist/{app-CcbYGJ22.js → app-C04LPGZa.js} +1606 -918
  14. package/dist/app.js +4 -4
  15. package/dist/composables/useReportPermissions.d.ts +14 -0
  16. package/dist/{dayjs.min-CgN1oBQf.js → dayjs.min-CKv07Hiu.js} +1 -1
  17. package/dist/employee-DyW4lRCb.js +144 -0
  18. package/dist/helpers/permission-set.d.ts +37 -0
  19. package/dist/helpers/rule.d.ts +1 -1
  20. package/dist/index-CIz_Nsy5.js +10340 -0
  21. package/dist/index-DGq_eY85.js +827 -0
  22. package/dist/{lodash-7Am6_Zd3.js → lodash-r0Tf8VGX.js} +1 -1
  23. package/dist/stores/permission-set.d.ts +15 -0
  24. package/dist/stores/team.d.ts +4 -1
  25. package/dist/style.css +1 -1
  26. package/dist/team-CSB4_BXX.js +29 -0
  27. package/dist/{timesheet-DKhEeLe7.js → timesheet-CTS0MzUs.js} +2 -2
  28. package/dist/tsconfig.app.tsbuildinfo +1 -1
  29. package/dist/types/audit-log.d.ts +1 -19
  30. package/dist/types/permission-set.d.ts +4 -0
  31. package/dist/types/report-query.d.ts +6 -0
  32. package/dist/{useAppStore-DOSLuH24.js → useAppStore-CWtHdJdl.js} +34 -46
  33. package/dist/{useLoading-BA-GSZ3R.js → useLoading-gYEFsA3E.js} +1 -1
  34. package/dist/useReportPermissions--n283f22.js +65 -0
  35. package/dist/views/audit-log/locales/index.d.ts +84 -0
  36. package/dist/views/team/locales/index.d.ts +32 -8
  37. package/package.json +4 -2
  38. package/dist/AuditLogList-DNQh1rE9.js +0 -316
  39. package/dist/EmployeeList-zU7fmC4c.js +0 -607
  40. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BvjXcknf.js +0 -3050
  41. package/dist/RoleList-jbZqer7A.js +0 -496
  42. package/dist/RolePermissionList-Dd8ks5i7.js +0 -285
  43. package/dist/TeamMemberList-uamoOFIV.js +0 -949
  44. package/dist/employee-khk560IC.js +0 -172
  45. package/dist/index-D5sdamN5.js +0 -8411
  46. package/dist/team-CFyc6tnm.js +0 -26
  47. package/dist/types/permission.d.ts +0 -1
  48. /package/dist/views/team/{role/RolePermissionForm.vue.d.ts → permission-set/PermissionSetForm.vue.d.ts} +0 -0
  49. /package/dist/views/team/{role/RolePermissionList.vue.d.ts → permission-set/PermissionSetList.vue.d.ts} +0 -0
package/dist/app.js CHANGED
@@ -1,6 +1,6 @@
1
- import { d as a, i as o, e as p } from "./app-CcbYGJ22.js";
1
+ import { b as e, i as r, r as o } from "./app-C04LPGZa.js";
2
2
  export {
3
- a as FmApp,
4
- o as i18nMessages,
5
- p as routes
3
+ e as FmApp,
4
+ r as i18nMessages,
5
+ o as routes
6
6
  };
@@ -0,0 +1,14 @@
1
+ export declare function useReportPermissions(): {
2
+ fetchReportPermissions: () => Promise<void>;
3
+ allReportPermissions: import("vue").ComputedRef<{
4
+ reason?: string | null | undefined;
5
+ conditions?: any;
6
+ fields?: string[] | null | undefined;
7
+ inverted?: boolean | null | undefined;
8
+ label: string;
9
+ subject: string;
10
+ actions: ("update" | "create" | "read" | "delete" | "manage")[];
11
+ }[]>;
12
+ availableReportKeys: import("vue").ComputedRef<Set<string>>;
13
+ isLoading: import("vue").ComputedRef<boolean>;
14
+ };
@@ -1,4 +1,4 @@
1
- import { g as Q, c as K } from "./app-CcbYGJ22.js";
1
+ import { g as Q, c as K } from "./app-C04LPGZa.js";
2
2
  var E = { exports: {} };
3
3
  (function(V, X) {
4
4
  (function(W, k) {
@@ -0,0 +1,144 @@
1
+ import { d as T } from "./dayjs.min-CKv07Hiu.js";
2
+ import { defineStore as _, storeToRefs as U } from "pinia";
3
+ import { ref as I } from "vue";
4
+ import { useCoreStore as $ } from "@feedmepos/mf-common";
5
+ import { b as r, g as o, t as b, k as S, s as v } from "./index-CIz_Nsy5.js";
6
+ import { u as x } from "./useAppStore-CWtHdJdl.js";
7
+ const n = {
8
+ async readEmployees() {
9
+ return o(await r().get("/pos-users"));
10
+ },
11
+ async createEmployee(e) {
12
+ return o(await r().post("/pos-users", e));
13
+ },
14
+ async createMasterEmployee(e) {
15
+ return o(await r().post("/pos-users/master-user", e));
16
+ },
17
+ async migrateToMasterEmployee(e, t) {
18
+ return o(await r().put(`/pos-users/migrate/${e}`, t));
19
+ },
20
+ async updateEmployee(e, t) {
21
+ return o(await r().put(`/pos-users/${e}`, t));
22
+ },
23
+ async updateMasterEmployee(e, t) {
24
+ return o(await r().put(`/pos-users/master-user/${e}`, t));
25
+ },
26
+ async deleteEmployee(e) {
27
+ return o(
28
+ await r().put(`/pos-users/${e._id}`, {
29
+ user: e,
30
+ roles: []
31
+ })
32
+ );
33
+ },
34
+ async deleteMasterEmployee(e) {
35
+ return o(
36
+ await r().put(`/pos-users/master-user/${e._id}`, {
37
+ user: e,
38
+ roles: []
39
+ })
40
+ );
41
+ },
42
+ async generateEmployeePasscode() {
43
+ return `${o(await r().get("/pos-users/generate-passcode"))}`;
44
+ },
45
+ async syncUsersMeta() {
46
+ await r().post("/pos-users/create-users-meta");
47
+ }
48
+ };
49
+ async function i(e) {
50
+ const t = x().roles.value, { restaurants: d } = $(), M = e.reduce((u, l) => {
51
+ var w;
52
+ const { _id: E, restaurantId: m } = l, p = u.findIndex((s) => s._id === E), g = ((w = d.value.find((s) => s._id === m)) == null ? void 0 : w.profile.name) || "", c = t.find((s) => s._id === l.role), f = {
53
+ restaurantId: m,
54
+ restaurantName: g,
55
+ roleId: (c == null ? void 0 : c._id) || "",
56
+ roleName: (c == null ? void 0 : c.name) || ""
57
+ };
58
+ return p < 0 ? u.push({
59
+ ...l,
60
+ since: T(S(E)).format("DD/MM/YYYY"),
61
+ restaurants: [f]
62
+ }) : u[p].restaurants.some((s) => s.restaurantId === m) || (u[p].restaurants = v([...u[p].restaurants, f], {
63
+ selector: "restaurantName"
64
+ })), u;
65
+ }, []);
66
+ return v(M, { selector: "name" });
67
+ }
68
+ const D = _("employee", () => {
69
+ const e = I([]), t = I(!1), d = I([]);
70
+ async function M() {
71
+ try {
72
+ t.value = !0;
73
+ const s = await n.readEmployees();
74
+ e.value = await i(s);
75
+ } catch (s) {
76
+ console.log("Error reading employees:", s);
77
+ } finally {
78
+ t.value = !1;
79
+ }
80
+ }
81
+ async function u(s) {
82
+ const a = await n.createEmployee(s);
83
+ e.value = await i(a);
84
+ }
85
+ async function l(s, a) {
86
+ const y = await n.updateEmployee(s, a);
87
+ e.value = await i(y);
88
+ }
89
+ async function E(s) {
90
+ const a = await n.deleteEmployee(s);
91
+ e.value = await i(a);
92
+ }
93
+ async function m(s) {
94
+ const a = await n.deleteMasterEmployee(s);
95
+ e.value = await i(a);
96
+ }
97
+ async function p(s) {
98
+ const a = await n.createMasterEmployee(s);
99
+ e.value = await i(a);
100
+ }
101
+ async function g(s, a) {
102
+ const y = await n.updateMasterEmployee(s, a);
103
+ e.value = await i(y);
104
+ }
105
+ async function c(s, a) {
106
+ const y = await n.migrateToMasterEmployee(s, a);
107
+ e.value = await i(y);
108
+ }
109
+ async function f() {
110
+ try {
111
+ d.value = await b.readTeamMemberPosUserIds();
112
+ } catch (s) {
113
+ console.log("Error reading team member pos user ids:", s);
114
+ }
115
+ }
116
+ async function w() {
117
+ await n.syncUsersMeta();
118
+ }
119
+ return {
120
+ employees: e,
121
+ restrictEmployeeIds: d,
122
+ isLoading: t,
123
+ readEmployees: M,
124
+ createEmployee: u,
125
+ updateEmployee: l,
126
+ deleteEmployee: E,
127
+ createMasterEmployee: p,
128
+ updateMasterEmployee: g,
129
+ deleteMasterEmployee: m,
130
+ migrateToMasterUser: c,
131
+ readTeamMemberPosUserIds: f,
132
+ syncUsersMeta: w
133
+ };
134
+ }), R = () => {
135
+ const e = D();
136
+ return {
137
+ ...e,
138
+ ...U(e)
139
+ };
140
+ };
141
+ export {
142
+ n as E,
143
+ R as u
144
+ };
@@ -1,5 +1,21 @@
1
1
  import type { InheritedPermission, IFdtoPermissionSet } from '@/types/permission-set';
2
2
  import type { FdoPermissionRule } from '@feedmepos/core/entity';
3
+ /**
4
+ * Recursively collect all permission sets following permissionSetIds links.
5
+ * Returns a flat, deduplicated list in depth-first order (parent before children).
6
+ * Cycle-safe via the visited set.
7
+ */
8
+ export declare function collectAllPermissionSets(setIds: string[], allSets: IFdtoPermissionSet[], visited?: Set<string>): IFdtoPermissionSet[];
9
+ /**
10
+ * Compute the effective permissions from a list of permission sets.
11
+ *
12
+ * Unlike a raw `mergePermissionSet().map(...)`, this correctly handles sets that store
13
+ * override diffs (inverted rules): it first merges all grants and denials from the sets,
14
+ * then applies the denials on top of the grants via `getEffectivePermissions`, producing a
15
+ * clean list of effective grants only. This ensures that subjects removed by a child set's
16
+ * inversion are not incorrectly shown as granted.
17
+ */
18
+ export declare function mergeToEffectivePermissions(sets: IFdtoPermissionSet[]): FdoPermissionRule[];
3
19
  /**
4
20
  * Transform permission sets by grouping role names by collection IDs for a specific field
5
21
  * @param permissionSets - Array of permission sets with their permissions
@@ -23,6 +39,13 @@ export declare function transformByCollection(permissionSets: IFdtoPermissionSet
23
39
  * - If user has conditions and base doesn't, return user's rule (user added)
24
40
  */
25
41
  export declare function getOverridePermissions(basePermissions: FdoPermissionRule[], overridePermissions: FdoPermissionRule[]): FdoPermissionRule[];
42
+ export declare function materializeSystemPermissionSetOverrides(overridePermissions: FdoPermissionRule[]): FdoPermissionRule[];
43
+ /**
44
+ * Strip positive rules whose subject would be re-injected by system permission set expansion.
45
+ * These need not be persisted to DB — expansion re-adds them at runtime.
46
+ * Inverted rules (explicit user denials) are always preserved.
47
+ */
48
+ export declare function stripSystemExpandedPositives(permissions: FdoPermissionRule[]): FdoPermissionRule[];
26
49
  /**
27
50
  * Combine base permissions with override permissions to get effective permissions
28
51
  * @param basePermissions - Base permissions from permission sets
@@ -30,3 +53,17 @@ export declare function getOverridePermissions(basePermissions: FdoPermissionRul
30
53
  * @returns - Combined effective permissions
31
54
  */
32
55
  export declare function getEffectivePermissions(basePermissions: FdoPermissionRule[], overridePermissions: FdoPermissionRule[]): FdoPermissionRule[];
56
+ /**
57
+ * Compute the initial permissions for the permission editor.
58
+ *
59
+ * Like `getEffectivePermissions`, but also preserves "orphaned" inverted rules — denials whose
60
+ * subject is NOT present in any base permission set (i.e. they target system-expanded subjects,
61
+ * not permission-set-inherited subjects). These denials seed `visitedSetIds` in
62
+ * `expandWithSystemPermissionSets` to block runtime re-expansion of system sets that the user
63
+ * explicitly unchecked. Without them the editor would initialise without the denial guard and
64
+ * those subjects would reappear as checked the next time the form opens.
65
+ *
66
+ * Inverted rules whose subject IS in base are handled correctly by `getEffectivePermissions`
67
+ * already (they cancel the inherited grant) and do not need special treatment here.
68
+ */
69
+ export declare function getEditorPermissions(basePermissions: FdoPermissionRule[], customPermissions: FdoPermissionRule[]): FdoPermissionRule[];
@@ -1,7 +1,7 @@
1
1
  import type { RawRule } from '@casl/ability';
2
2
  import { F_RULE_SUBJECT, type FdoPermissionRule } from '@feedmepos/core/entity';
3
3
  import type { Rule } from '../types/role';
4
- export declare function filterPermissions(permissions: FdoPermissionRule[], subject: F_RULE_SUBJECT): string;
4
+ export declare function filterPermissions(permissions: FdoPermissionRule[], subject: F_RULE_SUBJECT, availablePermissions?: FdoPermissionRule[]): string;
5
5
  export declare function ruleExtension(rule: FdoPermissionRule): {
6
6
  conditions: any;
7
7
  isDiscountOperation: boolean;