@flowselections/admin-installatietechniek 1.0.3 → 1.0.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-lib/components/AdminForInstallatieTechniek.d.ts +4 -0
- package/dist-lib/components/AdminForInstallatieTechniek.d.ts.map +1 -1
- package/dist-lib/components/AdminForInstallatieTechniek.js +212 -197
- package/dist-lib/hooks/useModulePermission.d.ts +4 -3
- package/dist-lib/hooks/useModulePermission.d.ts.map +1 -1
- package/dist-lib/hooks/useModulePermission.js +10 -6
- package/dist-lib/index.d.ts +1 -3
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/index.js +0 -1
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +407 -0
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +407 -0
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +407 -0
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +411 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/admin.functions.d.ts +48897 -1136
- package/dist-lib/lib/admin.functions.d.ts.map +1 -1
- package/dist-lib/lib/admin.functions.js +340 -181
- package/dist-lib/lib/moduleDiscovery.d.ts +7 -2
- package/dist-lib/lib/moduleDiscovery.d.ts.map +1 -1
- package/dist-lib/lib/moduleDiscovery.js +26 -11
- package/package.json +87 -87
- package/dist-lib/hooks/useModuleOrder.d.ts +0 -30
- package/dist-lib/hooks/useModuleOrder.d.ts.map +0 -1
- package/dist-lib/hooks/useModuleOrder.js +0 -99
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
export type ModulePermission = "none" | "view" | "edit";
|
|
2
2
|
/**
|
|
3
3
|
* Haalt de effectieve rechten van de ingelogde gebruiker op voor alle
|
|
4
|
-
* geregistreerde modules. Persoonlijke uitzonderingen winnen
|
|
4
|
+
* geregistreerde modules en onderdelen. Persoonlijke uitzonderingen winnen
|
|
5
|
+
* van rolrechten.
|
|
5
6
|
*/
|
|
6
7
|
export declare function useMyModulePermissions(): {
|
|
7
8
|
permissions: Record<string, ModulePermission>;
|
|
8
9
|
loading: boolean;
|
|
9
10
|
};
|
|
10
|
-
/** Effectief recht voor één module: "none" | "view" | "edit". */
|
|
11
|
-
export declare function useModulePermission(moduleId: string): {
|
|
11
|
+
/** Effectief recht voor één module of onderdeel: "none" | "view" | "edit". */
|
|
12
|
+
export declare function useModulePermission(moduleId: string, featureId?: string): {
|
|
12
13
|
permission: ModulePermission;
|
|
13
14
|
canView: boolean;
|
|
14
15
|
canEdit: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModulePermission.d.ts","sourceRoot":"","sources":["../../src/hooks/useModulePermission.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"useModulePermission.d.ts","sourceRoot":"","sources":["../../src/hooks/useModulePermission.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAIxD;;;;GAIG;AACH,wBAAgB,sBAAsB;;;EA2BrC;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,SAAK;;;;;EAUnE"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
2
|
import { supabase } from "../integrations/supabase/client";
|
|
3
|
+
const cellKey = (moduleId, featureId) => `${moduleId}::${featureId}`;
|
|
3
4
|
/**
|
|
4
5
|
* Haalt de effectieve rechten van de ingelogde gebruiker op voor alle
|
|
5
|
-
* geregistreerde modules. Persoonlijke uitzonderingen winnen
|
|
6
|
+
* geregistreerde modules en onderdelen. Persoonlijke uitzonderingen winnen
|
|
7
|
+
* van rolrechten.
|
|
6
8
|
*/
|
|
7
9
|
export function useMyModulePermissions() {
|
|
8
10
|
const [permissions, setPermissions] = useState({});
|
|
@@ -13,11 +15,13 @@ export function useMyModulePermissions() {
|
|
|
13
15
|
const { data, error } = await supabase.rpc("my_module_permissions");
|
|
14
16
|
if (cancelled)
|
|
15
17
|
return;
|
|
16
|
-
const rows = Array.isArray(data)
|
|
18
|
+
const rows = Array.isArray(data)
|
|
19
|
+
? data
|
|
20
|
+
: [];
|
|
17
21
|
if (!error) {
|
|
18
22
|
const map = {};
|
|
19
23
|
for (const row of rows) {
|
|
20
|
-
map[row.module_id] = row.permission;
|
|
24
|
+
map[cellKey(row.module_id, row.feature_id ?? "")] = row.permission;
|
|
21
25
|
}
|
|
22
26
|
setPermissions(map);
|
|
23
27
|
}
|
|
@@ -29,10 +33,10 @@ export function useMyModulePermissions() {
|
|
|
29
33
|
}, []);
|
|
30
34
|
return { permissions, loading };
|
|
31
35
|
}
|
|
32
|
-
/** Effectief recht voor één module: "none" | "view" | "edit". */
|
|
33
|
-
export function useModulePermission(moduleId) {
|
|
36
|
+
/** Effectief recht voor één module of onderdeel: "none" | "view" | "edit". */
|
|
37
|
+
export function useModulePermission(moduleId, featureId = "") {
|
|
34
38
|
const { permissions, loading } = useMyModulePermissions();
|
|
35
|
-
const permission = permissions[moduleId] ?? "none";
|
|
39
|
+
const permission = permissions[cellKey(moduleId, featureId)] ?? permissions[cellKey(moduleId, "")] ?? "none";
|
|
36
40
|
return {
|
|
37
41
|
permission,
|
|
38
42
|
canView: permission === "view" || permission === "edit",
|
package/dist-lib/index.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ export type { AdminForInstallatieTechniekProps, AdminModuleInput } from './compo
|
|
|
5
5
|
export { useModulePermission, useMyModulePermissions } from './hooks/useModulePermission';
|
|
6
6
|
export type { ModulePermission } from './hooks/useModulePermission';
|
|
7
7
|
export { useDiscoveredModules } from './lib/moduleDiscovery';
|
|
8
|
-
export type { DiscoveredModule } from './lib/moduleDiscovery';
|
|
9
|
-
export { useModuleOrder, sortModulesByOrder, notifyModuleOrderChanged } from './hooks/useModuleOrder';
|
|
10
|
-
export type { ModuleOrderEntry } from './hooks/useModuleOrder';
|
|
8
|
+
export type { DiscoveredModule, DiscoveredFeature } from './lib/moduleDiscovery';
|
|
11
9
|
export declare const adminInstallatietechniekModule: FlowModule;
|
|
12
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist-lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,YAAY,EAAE,gCAAgC,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACnH,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1F,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,YAAY,EAAE,gCAAgC,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACnH,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1F,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAGjF,eAAO,MAAM,8BAA8B,EAAE,UAY5C,CAAC"}
|
package/dist-lib/index.js
CHANGED
|
@@ -6,7 +6,6 @@ export * from './_core-safelist';
|
|
|
6
6
|
export { AdminForInstallatieTechniek } from './components/AdminForInstallatieTechniek';
|
|
7
7
|
export { useModulePermission, useMyModulePermissions } from './hooks/useModulePermission';
|
|
8
8
|
export { useDiscoveredModules } from './lib/moduleDiscovery';
|
|
9
|
-
export { useModuleOrder, sortModulesByOrder, notifyModuleOrderChanged } from './hooks/useModuleOrder';
|
|
10
9
|
export const adminInstallatietechniekModule = {
|
|
11
10
|
id: "admin-installatietechniek",
|
|
12
11
|
name: "Admin Installatietechniek",
|