fix(app): grant expiry ends the chosen day in Paris; species order 0..9999 (V1-2.5 L2)
Owner checkpoint 2026-11-02: expiry 23:59:59.999 Europe/Paris (picker, validation, display), tests under non-Paris zones and DST days; M7 redefines create_species and update_inactive_species with the range check; pgTAP 015 and 022; « Relecteur ou relectrice »; object_conflict EN; setup key selectable, no Copy.
This commit is contained in:
1 parent
4111efa1d1
commit
51225cacf6
17 files changed
+437
-61
No files matched your search
@@ -4,7 +4,7 @@
|
||||
-- unknown, deleted, personal or forbidden sheet gets one answer. Fixtures are
|
||||
-- scoped to the ids created here.
|
||||
begin;
|
||||
select plan(43);
|
||||
select plan(60);
|
||||
|
||||
-- Accounts. O owner, A admin, E admin + editor, V reviewer, P admin +
|
||||
-- publisher, R reader, N no right. Every one has a verified factor and a live
|
||||
@@ -193,5 +193,37 @@ select is((select string_agg(p.provolatile::text, ',' order by p.proname) from p
|
||||
where n.nspname = 'public' and p.proname in ('list_official_sheets_admin', 'get_official_sheet_admin')), 's,s',
|
||||
'both reads are stable: no write path');
|
||||
|
||||
-- ============ Species order range (owner 2026-11-02) ============
|
||||
-- The stored order of an inactive species, read with the owner's rights (RLS hides inactive rows).
|
||||
create function pg_temp.stored_order(p_id text) returns text language plpgsql security definer as $$
|
||||
begin
|
||||
return (select sort_order::text from public.species where id = p_id);
|
||||
end $$;
|
||||
grant execute on function pg_temp.stored_order(text) to authenticated;
|
||||
select pg_temp.as_user('E', 'aal2');
|
||||
select is(pg_temp.val($$ select public.create_species('m22-neg', 'Négatif', 'Negative', -1) $$), 'P0001 invalid_input', 'create_species: -1 refused');
|
||||
select is(pg_temp.val($$ select public.create_species('m22-big', 'Grand', 'Big', 10000) $$), 'P0001 invalid_input', 'create_species: 10 000 refused');
|
||||
select is(pg_temp.val($$ select public.create_species('m22-zero', 'Zéro', 'Zero', 0) $$), 'm22-zero', 'create_species: 0 accepted');
|
||||
select is(pg_temp.val($$ select public.create_species('m22-max', 'Max', 'Max', 9999) $$), 'm22-max', 'create_species: 9 999 accepted');
|
||||
select is(pg_temp.val($$ select public.create_species('m22-null', 'Nul', 'Null', null) $$), 'm22-null', 'create_species: null accepted');
|
||||
select is(coalesce(pg_temp.stored_order('m22-neg'), 'none') || '/' || coalesce(pg_temp.stored_order('m22-big'), 'none'), 'none/none', 'create_species: refused orders store nothing');
|
||||
select is(pg_temp.stored_order('m22-zero') || ',' || pg_temp.stored_order('m22-max') || ',' || pg_temp.stored_order('m22-null'),
|
||||
'0,9999,100', 'create_species: stored orders, null keeps the default 100');
|
||||
select is(pg_temp.val($$ select public.update_inactive_species('m22-zero', 'Zéro', 'Zero', -1) $$), 'P0001 invalid_input', 'update_inactive_species: -1 refused');
|
||||
select is(pg_temp.val($$ select public.update_inactive_species('m22-zero', 'Zéro', 'Zero', 10000) $$), 'P0001 invalid_input', 'update_inactive_species: 10 000 refused');
|
||||
select is(pg_temp.val($$ select public.update_inactive_species('m22-zero', 'Zéro', 'Zero', 9999) $$), 'm22-zero', 'update_inactive_species: 9 999 accepted');
|
||||
select is(pg_temp.stored_order('m22-zero'), '9999', 'update_inactive_species: 9 999 stored');
|
||||
select is(pg_temp.val($$ select public.update_inactive_species('m22-zero', 'Zéro', 'Zero', 0) $$), 'm22-zero', 'update_inactive_species: 0 accepted');
|
||||
select is(pg_temp.stored_order('m22-zero'), '0', 'update_inactive_species: 0 stored');
|
||||
select is(pg_temp.val($$ select public.update_inactive_species('m22-max', 'Max', 'Max', null) $$), 'm22-max', 'update_inactive_species: null accepted');
|
||||
select is(pg_temp.stored_order('m22-max'), '9999', 'update_inactive_species: null keeps the stored order');
|
||||
select pg_temp.as_user('V', 'aal2');
|
||||
select is(pg_temp.val($$ select public.create_species('m22-rev', 'Rev', 'Rev', 5) $$), '42501 rights.capability', 'create_species: a reviewer is still refused');
|
||||
reset role;
|
||||
select is((select string_agg(p.prosecdef::text || '/' || (p.proconfig = array['search_path=""'])::text, ',' order by p.proname) from pg_proc p
|
||||
join pg_namespace n on n.oid = p.pronamespace
|
||||
where n.nspname = 'public' and p.proname in ('create_species', 'update_inactive_species')),
|
||||
'true/true,true/true', 'both species RPCs: security definer, empty search_path');
|
||||
|
||||
select * from finish();
|
||||
rollback;
|
||||
Reference in new issue
Block a user