@flowselections/floriday-verkoop-module 1.0.113 → 1.0.116
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const MODULE_VERSION = "1.0.
|
|
1
|
+
export declare const MODULE_VERSION = "1.0.114";
|
|
2
2
|
//# sourceMappingURL=module-version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowselections/floriday-verkoop-module",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.116",
|
|
4
4
|
"private": false,
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"lint": "eslint ."
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@flowselections/core": "1.0.
|
|
37
|
+
"@flowselections/core": "1.0.30",
|
|
38
38
|
"@tanstack/react-query": "^5.0.0",
|
|
39
39
|
"@tanstack/react-router": "^1.0.0",
|
|
40
40
|
"@tanstack/react-start": "^1.0.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@cloudflare/vite-plugin": "^1.25.5",
|
|
54
54
|
"@eslint/js": "^9.32.0",
|
|
55
|
-
"@flowselections/core": "1.0.
|
|
55
|
+
"@flowselections/core": "1.0.30",
|
|
56
56
|
"@lovable.dev/vite-tanstack-config": "2.26.5",
|
|
57
57
|
"@rsbuild/core": "^1.0.0",
|
|
58
58
|
"@tailwindcss/vite": "^4.2.1",
|
package/schema/verkoop.sql
CHANGED
|
@@ -1315,6 +1315,10 @@ BEGIN
|
|
|
1315
1315
|
WHERE floriday_id = NEW.floriday_id;
|
|
1316
1316
|
|
|
1317
1317
|
IF v_num IS NULL OR v_num !~ '^FO-[0-9]{7}$' THEN
|
|
1318
|
+
IF to_regprocedure('public.next_order_number_for_date(text,timestamp with time zone)') IS NULL THEN
|
|
1319
|
+
RAISE WARNING 'Ordernummer niet toegekend: next_order_number_for_date ontbreekt';
|
|
1320
|
+
RETURN NEW;
|
|
1321
|
+
END IF;
|
|
1318
1322
|
v_num := public.next_order_number_for_date('FO', NEW.created_at);
|
|
1319
1323
|
INSERT INTO public.floriday_order_number_map(floriday_id, order_number)
|
|
1320
1324
|
VALUES (NEW.floriday_id, v_num)
|
|
@@ -1490,44 +1494,7 @@ END;
|
|
|
1490
1494
|
$function$
|
|
1491
1495
|
;
|
|
1492
1496
|
|
|
1493
|
-
|
|
1494
|
-
RETURNS trigger
|
|
1495
|
-
LANGUAGE plpgsql
|
|
1496
|
-
SECURITY DEFINER
|
|
1497
|
-
SET search_path TO 'public'
|
|
1498
|
-
AS $function$
|
|
1499
|
-
DECLARE
|
|
1500
|
-
oi RECORD; v_src text; v_proof jsonb; v_ids text[]; v_reason text;
|
|
1501
|
-
v_ready_statuses text[] := ARRAY['klaar voor verzending','ready','ready_to_ship','verzonden','shipped','delivered','geleverd',
|
|
1502
|
-
'afgehandeld','completed','gereed','picked','gereedgemeld','done'];
|
|
1503
|
-
BEGIN
|
|
1504
|
-
IF LOWER(COALESCE(NEW.status,'')) = ANY(v_ready_statuses)
|
|
1505
|
-
AND (OLD.status IS NULL OR LOWER(COALESCE(OLD.status,'')) <> ALL(v_ready_statuses)) THEN
|
|
1506
|
-
v_ids := public.voorraad_external_fulfilled_ids(NEW.custom_fields);
|
|
1507
|
-
IF COALESCE(array_length(v_ids,1),0) > 0 THEN
|
|
1508
|
-
-- deel-afhandeling in Floriday: alleen de genoemde bestellingen
|
|
1509
|
-
PERFORM public.voorraad_consume_external_fulfilled(NEW.id, v_ids, NEW.order_source);
|
|
1510
|
-
RETURN NEW;
|
|
1511
|
-
END IF;
|
|
1512
|
-
v_proof := public.order_departure_proof(NEW.id);
|
|
1513
|
-
IF NOT COALESCE((v_proof->>'ok')::boolean, false) THEN
|
|
1514
|
-
INSERT INTO public.stock_mutation_log(order_id, order_item_id, order_source, mutation_type, qty_delta, reason, created_by)
|
|
1515
|
-
SELECT NEW.id, oi2.id, public.normalize_order_source(COALESCE(NEW.order_source,'HO')), 'consumption_blocked', COALESCE(oi2.quantity,0),
|
|
1516
|
-
'status ' || COALESCE(NEW.status,'') || ' zonder bewijs van vertrek: ' || COALESCE(v_proof->>'reason','onbekend'), auth.uid()
|
|
1517
|
-
FROM logistics_active.order_items oi2 WHERE oi2.order_id = NEW.id;
|
|
1518
|
-
RETURN NEW;
|
|
1519
|
-
END IF;
|
|
1520
|
-
v_src := COALESCE(NEW.order_source,'HO');
|
|
1521
|
-
v_reason := CASE WHEN NEW.custom_fields ? 'floriday_external_fulfilled_at' THEN 'Afgehandeld in Floriday'
|
|
1522
|
-
ELSE 'order vertrokken (status ' || COALESCE(NEW.status,'') || ')' END;
|
|
1523
|
-
FOR oi IN SELECT id FROM logistics_active.order_items WHERE order_id = NEW.id LOOP
|
|
1524
|
-
PERFORM public.consume_order_item(NEW.id, oi.id, v_src, v_reason);
|
|
1525
|
-
END LOOP;
|
|
1526
|
-
PERFORM public.recompute_reserved_for_order(NEW.id);
|
|
1527
|
-
END IF;
|
|
1528
|
-
RETURN NEW;
|
|
1529
|
-
END $function$
|
|
1530
|
-
;
|
|
1497
|
+
-- trg_orders_consume_on_complete_fn: eigenaar is Voorraad; Verkoop maakt hem sinds 1.0.114 niet meer aan.
|
|
1531
1498
|
|
|
1532
1499
|
CREATE OR REPLACE FUNCTION public.trg_orders_replan()
|
|
1533
1500
|
RETURNS trigger
|
|
@@ -2185,3 +2152,206 @@ $function$;
|
|
|
2185
2152
|
|
|
2186
2153
|
REVOKE ALL ON FUNCTION public.verkoop_insert_manual_order(jsonb, jsonb, text) FROM PUBLIC, anon, authenticated;
|
|
2187
2154
|
GRANT EXECUTE ON FUNCTION public.verkoop_insert_manual_order(jsonb, jsonb, text) TO service_role;
|
|
2155
|
+
|
|
2156
|
+
-- ── Verkoop 1.0.114: eigen toegangspoort in elke beschermde functie ──
|
|
2157
|
+
-- Werkt ook na een schemasync zonder REVOKE: de functie controleert zelf wie hem aanroept.
|
|
2158
|
+
CREATE OR REPLACE FUNCTION public.verkoop_is_server()
|
|
2159
|
+
RETURNS boolean
|
|
2160
|
+
LANGUAGE sql
|
|
2161
|
+
STABLE
|
|
2162
|
+
SET search_path TO 'public'
|
|
2163
|
+
AS $function$
|
|
2164
|
+
SELECT coalesce(nullif(current_setting('request.jwt.claims', true), '')::jsonb ->> 'role', '') = 'service_role'
|
|
2165
|
+
OR session_user::text <> 'authenticator';
|
|
2166
|
+
$function$;
|
|
2167
|
+
|
|
2168
|
+
CREATE OR REPLACE FUNCTION public.verkoop_assert_caller(p_level text, p_roles public.app_role[] DEFAULT NULL)
|
|
2169
|
+
RETURNS void
|
|
2170
|
+
LANGUAGE plpgsql
|
|
2171
|
+
STABLE
|
|
2172
|
+
SET search_path TO 'public'
|
|
2173
|
+
AS $function$
|
|
2174
|
+
DECLARE
|
|
2175
|
+
v_uid uuid := auth.uid();
|
|
2176
|
+
v_role public.app_role;
|
|
2177
|
+
v_ctx text;
|
|
2178
|
+
BEGIN
|
|
2179
|
+
IF public.verkoop_is_server() THEN RETURN; END IF;
|
|
2180
|
+
IF p_level = 'server' THEN
|
|
2181
|
+
RAISE EXCEPTION USING ERRCODE = '42501', MESSAGE = 'Deze functie is alleen voor de server.';
|
|
2182
|
+
ELSIF p_level = 'ingelogd' THEN
|
|
2183
|
+
IF v_uid IS NOT NULL THEN RETURN; END IF;
|
|
2184
|
+
ELSIF p_level = 'keten' THEN
|
|
2185
|
+
IF v_uid IS NOT NULL OR pg_trigger_depth() > 0 THEN RETURN; END IF;
|
|
2186
|
+
ELSIF p_level = 'keten_genest' THEN
|
|
2187
|
+
-- Ingelogd, trigger, of geneste aanroep vanuit een andere databasefunctie.
|
|
2188
|
+
-- Genest = de aanroepstapel (PG_CONTEXT) bevat meer dan deze poort en de
|
|
2189
|
+
-- beschermde functie zelf. Een rechtstreekse API-aanroep heeft er precies twee.
|
|
2190
|
+
IF v_uid IS NOT NULL OR pg_trigger_depth() > 0 THEN RETURN; END IF;
|
|
2191
|
+
GET DIAGNOSTICS v_ctx = PG_CONTEXT;
|
|
2192
|
+
IF (SELECT count(*) FROM regexp_split_to_table(v_ctx, E'\n') l WHERE l ~ '^(PL/pgSQL|SQL) function ') > 2 THEN RETURN; END IF;
|
|
2193
|
+
ELSIF p_level = 'rol' THEN
|
|
2194
|
+
IF v_uid IS NOT NULL AND p_roles IS NOT NULL THEN
|
|
2195
|
+
FOREACH v_role IN ARRAY p_roles LOOP
|
|
2196
|
+
IF public.has_role(v_uid, v_role) THEN RETURN; END IF;
|
|
2197
|
+
END LOOP;
|
|
2198
|
+
RAISE EXCEPTION USING ERRCODE = '42501', MESSAGE = 'Je hebt geen rechten voor deze actie.';
|
|
2199
|
+
END IF;
|
|
2200
|
+
END IF;
|
|
2201
|
+
-- Onbekend niveau of geen inlog: weigeren.
|
|
2202
|
+
RAISE EXCEPTION USING ERRCODE = '42501', MESSAGE = 'Je moet ingelogd zijn om dit te doen.';
|
|
2203
|
+
END;
|
|
2204
|
+
$function$;
|
|
2205
|
+
|
|
2206
|
+
-- release_job_lock was SQL; als plpgsql opnieuw zodat hij de poort kan aanroepen.
|
|
2207
|
+
CREATE OR REPLACE FUNCTION public.release_job_lock(_key text)
|
|
2208
|
+
RETURNS void
|
|
2209
|
+
LANGUAGE plpgsql
|
|
2210
|
+
SECURITY DEFINER
|
|
2211
|
+
SET search_path TO 'public'
|
|
2212
|
+
AS $function$
|
|
2213
|
+
BEGIN
|
|
2214
|
+
PERFORM public.verkoop_assert_caller('ingelogd'); -- verkoop-poort
|
|
2215
|
+
UPDATE public.job_locks SET locked_until = now() - interval '1 second', updated_at = now()
|
|
2216
|
+
WHERE lock_key = _key;
|
|
2217
|
+
END;
|
|
2218
|
+
$function$;
|
|
2219
|
+
|
|
2220
|
+
-- Lijst: functie → niveau. Ook gebruikt door verkoop_install_check().
|
|
2221
|
+
CREATE OR REPLACE FUNCTION public.verkoop_guarded_functions()
|
|
2222
|
+
RETURNS TABLE(sig text, niveau text, rollen text, opmerking text)
|
|
2223
|
+
LANGUAGE sql
|
|
2224
|
+
IMMUTABLE
|
|
2225
|
+
SET search_path TO 'public'
|
|
2226
|
+
AS $function$
|
|
2227
|
+
SELECT * FROM (VALUES
|
|
2228
|
+
('verkoop_insert_manual_order(jsonb,jsonb,text)', 'server', NULL, NULL),
|
|
2229
|
+
('verkoop_create_order(text,text,uuid,date,uuid,uuid,jsonb,text,text,boolean,text,boolean,text)', 'keten_genest', NULL, 'verkoop_create_order: geneste aanroep toegestaan (Aanbiedingsmail), wacht op ronde Aanbiedingsmail. Let op: elke functie die anon mag uitvoeren en verkoop_create_order aanroept, wordt zo een open deur; de bescherming ligt dan bij die buitenste functie'),
|
|
2230
|
+
('verkoop_packing_drift_report()', 'rol', 'admin,superadmin', NULL),
|
|
2231
|
+
('verkoop_packing_drift_apply(uuid[])', 'rol', 'admin,superadmin', NULL),
|
|
2232
|
+
('assign_floriday_order_numbers(text[])', 'ingelogd', NULL, NULL),
|
|
2233
|
+
('get_or_assign_floriday_order_number(text)', 'keten', NULL, NULL),
|
|
2234
|
+
('next_order_number(text)', 'keten', NULL, NULL),
|
|
2235
|
+
('next_order_number_for_date(text,timestamp with time zone)', 'keten', NULL, NULL),
|
|
2236
|
+
('try_acquire_job_lock(text,integer,text)', 'ingelogd', NULL, 'voorlopig; wacht op melding client Floriday-authenticatie'),
|
|
2237
|
+
('release_job_lock(text)', 'ingelogd', NULL, 'voorlopig; wacht op melding client Floriday-authenticatie'),
|
|
2238
|
+
('order_departure_proof(uuid)', 'keten', NULL, NULL),
|
|
2239
|
+
('enqueue_cart_replan_if_unlocked(uuid)', 'keten', NULL, NULL),
|
|
2240
|
+
('replace_order_carts(uuid,uuid,jsonb)', 'ingelogd', NULL, NULL),
|
|
2241
|
+
('mark_shipment_shipped(uuid)', 'ingelogd', NULL, NULL),
|
|
2242
|
+
('mark_salesorder_controlled(text,boolean)', 'ingelogd', NULL, NULL),
|
|
2243
|
+
('reset_cart_layer_positions(uuid)', 'ingelogd', NULL, NULL),
|
|
2244
|
+
('move_cart_layer_position(uuid,integer,numeric,numeric)', 'ingelogd', NULL, NULL),
|
|
2245
|
+
('swap_cart_layer_positions(uuid,uuid)', 'ingelogd', NULL, NULL),
|
|
2246
|
+
('order_number_prefix(text,jsonb)', 'open', NULL, 'bewust open: rekenhulp zonder gegevens')
|
|
2247
|
+
) v(sig, niveau, rollen, opmerking);
|
|
2248
|
+
$function$;
|
|
2249
|
+
|
|
2250
|
+
-- Poort in de bestaande functies zetten (herhaalbaar: overslaan als hij er al staat).
|
|
2251
|
+
DO $do$
|
|
2252
|
+
DECLARE
|
|
2253
|
+
r record;
|
|
2254
|
+
v_def text;
|
|
2255
|
+
v_new text;
|
|
2256
|
+
v_call text;
|
|
2257
|
+
BEGIN
|
|
2258
|
+
FOR r IN SELECT * FROM public.verkoop_guarded_functions() WHERE niveau <> 'open' LOOP
|
|
2259
|
+
IF to_regprocedure('public.' || r.sig) IS NULL THEN
|
|
2260
|
+
RAISE NOTICE 'Verkoop-poort: % ontbreekt, overgeslagen', r.sig;
|
|
2261
|
+
CONTINUE;
|
|
2262
|
+
END IF;
|
|
2263
|
+
v_def := pg_get_functiondef(to_regprocedure('public.' || r.sig));
|
|
2264
|
+
v_new := v_def;
|
|
2265
|
+
|
|
2266
|
+
IF r.sig LIKE 'verkoop_create_order(%' THEN
|
|
2267
|
+
-- Tijdelijk ingelogd of server, zonder rolcontrole (wacht op Aanbiedingsmail).
|
|
2268
|
+
v_new := regexp_replace(v_new,
|
|
2269
|
+
'IF v_uid IS NOT NULL THEN\s*IF NOT \(public\.has_role\(v_uid, ''admin''\).*?ELSIF coalesce\(auth\.role\(\), ''''\) IN \(''anon'', ''authenticated''\) THEN\s*RAISE EXCEPTION ''Niet toegestaan'';\s*END IF;',
|
|
2270
|
+
'-- Toegang: zie verkoop-poort hierboven.');
|
|
2271
|
+
END IF;
|
|
2272
|
+
|
|
2273
|
+
IF r.sig LIKE 'verkoop_insert_manual_order(%' THEN
|
|
2274
|
+
-- Engine met p_actor: de server geeft de aanmaker mee in plaats van een gebruikerssessie na te bootsen.
|
|
2275
|
+
v_new := replace(v_new,
|
|
2276
|
+
'IF v_uid IS NULL AND v_set_by IS NOT NULL THEN',
|
|
2277
|
+
'IF v_uid IS NULL AND v_set_by IS NOT NULL AND to_regprocedure(''public.logistics_set_order_carrier(uuid,uuid,uuid)'') IS NULL THEN');
|
|
2278
|
+
v_new := replace(v_new,
|
|
2279
|
+
'EXECUTE ''SELECT public.logistics_set_order_carrier($1, $2)'' USING v_order_id, v_manual_carrier;',
|
|
2280
|
+
'IF to_regprocedure(''public.logistics_set_order_carrier(uuid,uuid,uuid)'') IS NOT NULL THEN
|
|
2281
|
+
EXECUTE ''SELECT public.logistics_set_order_carrier($1, $2, $3)'' USING v_order_id, v_manual_carrier, v_set_by;
|
|
2282
|
+
ELSE
|
|
2283
|
+
EXECUTE ''SELECT public.logistics_set_order_carrier($1, $2)'' USING v_order_id, v_manual_carrier;
|
|
2284
|
+
END IF;');
|
|
2285
|
+
END IF;
|
|
2286
|
+
|
|
2287
|
+
IF r.sig LIKE 'verkoop_create_order(%' THEN
|
|
2288
|
+
v_new := replace(v_new, 'PERFORM public.verkoop_assert_caller(''ingelogd''); -- verkoop-poort',
|
|
2289
|
+
'PERFORM public.verkoop_assert_caller(''keten_genest''); -- verkoop-poort');
|
|
2290
|
+
END IF;
|
|
2291
|
+
|
|
2292
|
+
IF position('verkoop_assert_caller' IN v_new) = 0 THEN
|
|
2293
|
+
v_call := format('PERFORM public.verkoop_assert_caller(%L%s); -- verkoop-poort',
|
|
2294
|
+
r.niveau,
|
|
2295
|
+
CASE WHEN r.rollen IS NULL THEN '' ELSE format(', %L::public.app_role[]', '{' || r.rollen || '}') END);
|
|
2296
|
+
v_new := regexp_replace(v_new, '(\$function\$.*?\mBEGIN\M)', E'\\1\n ' || v_call);
|
|
2297
|
+
END IF;
|
|
2298
|
+
|
|
2299
|
+
IF v_new IS DISTINCT FROM v_def THEN
|
|
2300
|
+
EXECUTE v_new;
|
|
2301
|
+
END IF;
|
|
2302
|
+
END LOOP;
|
|
2303
|
+
END
|
|
2304
|
+
$do$;
|
|
2305
|
+
|
|
2306
|
+
-- Rechten als extra laag (een schemasync neemt REVOKE niet mee; de poort blijft dan staan).
|
|
2307
|
+
REVOKE ALL ON FUNCTION public.verkoop_insert_manual_order(jsonb, jsonb, text) FROM PUBLIC, anon, authenticated;
|
|
2308
|
+
GRANT EXECUTE ON FUNCTION public.verkoop_insert_manual_order(jsonb, jsonb, text) TO service_role;
|
|
2309
|
+
GRANT EXECUTE ON FUNCTION public.verkoop_is_server() TO authenticated, service_role;
|
|
2310
|
+
GRANT EXECUTE ON FUNCTION public.verkoop_assert_caller(text, public.app_role[]) TO authenticated, service_role;
|
|
2311
|
+
|
|
2312
|
+
-- Controle na installatie of schemasync.
|
|
2313
|
+
CREATE OR REPLACE FUNCTION public.verkoop_install_check()
|
|
2314
|
+
RETURNS TABLE(soort text, naam text, aanwezig boolean, niveau text, poort_aanwezig boolean, anon_uitvoerrecht boolean, authenticated_uitvoerrecht boolean, opmerking text)
|
|
2315
|
+
LANGUAGE plpgsql
|
|
2316
|
+
STABLE SECURITY DEFINER
|
|
2317
|
+
SET search_path TO 'public'
|
|
2318
|
+
AS $function$
|
|
2319
|
+
BEGIN
|
|
2320
|
+
IF NOT public.verkoop_is_server() THEN
|
|
2321
|
+
PERFORM public.verkoop_assert_caller('rol', '{admin,superadmin}'::public.app_role[]);
|
|
2322
|
+
END IF;
|
|
2323
|
+
|
|
2324
|
+
RETURN QUERY
|
|
2325
|
+
SELECT 'functie'::text, g.sig,
|
|
2326
|
+
to_regprocedure('public.' || g.sig) IS NOT NULL,
|
|
2327
|
+
g.niveau,
|
|
2328
|
+
CASE WHEN g.niveau = 'open' THEN NULL
|
|
2329
|
+
ELSE coalesce(position('verkoop_assert_caller' IN (SELECT p.prosrc FROM pg_proc p WHERE p.oid = to_regprocedure('public.' || g.sig))) > 0, false) END,
|
|
2330
|
+
CASE WHEN to_regprocedure('public.' || g.sig) IS NULL THEN NULL ELSE has_function_privilege('anon', to_regprocedure('public.' || g.sig), 'EXECUTE') END,
|
|
2331
|
+
CASE WHEN to_regprocedure('public.' || g.sig) IS NULL THEN NULL ELSE has_function_privilege('authenticated', to_regprocedure('public.' || g.sig), 'EXECUTE') END,
|
|
2332
|
+
g.opmerking
|
|
2333
|
+
FROM public.verkoop_guarded_functions() g;
|
|
2334
|
+
|
|
2335
|
+
RETURN QUERY
|
|
2336
|
+
SELECT 'trigger'::text, t.tbl || '.' || t.trg,
|
|
2337
|
+
EXISTS (SELECT 1 FROM pg_trigger x WHERE x.tgname = t.trg AND x.tgrelid = to_regclass('public.' || t.tbl) AND NOT x.tgisinternal),
|
|
2338
|
+
NULL::text, NULL::boolean, NULL::boolean, NULL::boolean,
|
|
2339
|
+
CASE WHEN to_regclass('public.' || t.tbl) IS NULL THEN 'tabel ontbreekt' END
|
|
2340
|
+
FROM (VALUES
|
|
2341
|
+
('update_floriday_auto_fulfillment_log_updated_at','floriday_auto_fulfillment_log'),('trg_floriday_salesorders_assign_number','floriday_salesorders_cache'),('trg_assign_offer_order_number','offer_orders'),('order_items_replan_trg','order_items'),('trg_enqueue_cart_replan_order_items','order_items'),('orders_replan_trg','orders'),('orders_status_origin','orders'),('trg_enqueue_cart_replan_orders','orders'),('trg_orders_apply_buffer_decision','orders'),('trg_stock_mutation_alert','stock_mutation_log'),('order_shipments_assign_number','order_shipments'),('order_shipments_touch','order_shipments'),('order_shipment_items_recompute','order_shipment_items'),('order_shipment_items_touch','order_shipment_items'),('trg_order_buffers_updated_at','order_buffers'),('trg_invoice_timing_settings_touch','invoice_timing_settings'),('trg_stock_consumption_alerts_updated_at','stock_consumption_alerts'),('update_delivery_notes_updated_at','delivery_notes'),('floriday_status_sync_queue_touch','floriday_status_sync_queue')
|
|
2342
|
+
) t(trg, tbl);
|
|
2343
|
+
|
|
2344
|
+
RETURN QUERY
|
|
2345
|
+
SELECT 'policy'::text, pl.tbl || '.' || pl.pol,
|
|
2346
|
+
EXISTS (SELECT 1 FROM pg_policies x WHERE x.schemaname = 'public' AND x.tablename = pl.tbl AND x.policyname = pl.pol),
|
|
2347
|
+
NULL::text, NULL::boolean, NULL::boolean, NULL::boolean,
|
|
2348
|
+
CASE WHEN to_regclass('public.' || pl.tbl) IS NULL THEN 'tabel ontbreekt'
|
|
2349
|
+
WHEN NOT (SELECT c.relrowsecurity FROM pg_class c WHERE c.oid = to_regclass('public.' || pl.tbl)) THEN 'beveiliging per rij staat UIT op deze tabel' END
|
|
2350
|
+
FROM (VALUES
|
|
2351
|
+
('service role manages replan queue','cart_replan_queue'),('Authenticated can read delivery notes','delivery_notes'),('Ingelogde gebruikers lezen samenvoeglog','floriday_merge_log'),('Ingelogde gebruikers kunnen de statuswachtrij lezen','floriday_status_sync_queue'),('Ingelogde gebruikers kunnen statuswijzigingen aanmelden','floriday_status_sync_queue'),('Authenticated can manage invoice timing settings','invoice_timing_settings'),('job_locks service only','job_locks'),('Ingelogde gebruikers kunnen blokkademeldingen lezen','order_block_notifications'),('Authenticated users can manage order_buffers','order_buffers'),('Authenticated users can read order_buffers','order_buffers'),('authenticated_read_cart_layer_positions','order_cart_layer_positions'),('service_role_manage_cart_layer_positions','order_cart_layer_positions'),('Counters readable by authenticated','order_number_counters'),('Ingelogde gebruikers leggen weggehaalde meldingen vast','order_review_dismissals'),('Ingelogde gebruikers lezen weggehaalde meldingen','order_review_dismissals'),('Authenticated can delete order_shipment_items','order_shipment_items'),('Authenticated can insert order_shipment_items','order_shipment_items'),('Authenticated can read order_shipment_items','order_shipment_items'),('Authenticated can update order_shipment_items','order_shipment_items'),('Authenticated can delete order_shipments','order_shipments'),('Authenticated can insert order_shipments','order_shipments'),('Authenticated can read order_shipments','order_shipments'),('Authenticated can update order_shipments','order_shipments'),('Authenticated can manage stock consumption alerts','stock_consumption_alerts')
|
|
2352
|
+
) pl(pol, tbl);
|
|
2353
|
+
END;
|
|
2354
|
+
$function$;
|
|
2355
|
+
|
|
2356
|
+
REVOKE ALL ON FUNCTION public.verkoop_install_check() FROM PUBLIC, anon;
|
|
2357
|
+
GRANT EXECUTE ON FUNCTION public.verkoop_install_check() TO authenticated, service_role;
|