Files
alpenwerk-hr/db/migrations/20260714120500_default_grants.sql
Raphael Müllner b47dec6387 Übergabestand 2026-10-14
Alpenwerk HR — HR-Stammdatenverwaltung

Mitarbeiter:innen, Organisationsstruktur, Planstellen, Eintritt, Austritt,
Versetzung, Beförderung, Karenz, On- und Offboarding, Berichte, Exporte,
Massenimport und ein lückenloser Nachweis jeder Änderung.

Next.js 16, React 19 und TypeScript; PostgreSQL über Kysely; Anmeldung
ausschliesslich über Microsoft Entra ID. Die Fachlogik liegt in der
Datenbank, die Zugriffsschranke ist Row Level Security.

Betrieb auf Windows Server: siehe deploy/windows/README.md.
Sicherheitskonzept: docs/sicherheitskonzept.md.
2026-10-14 10:12:22 +02:00

22 lines
1.3 KiB
SQL

-- Explicit schema/table/sequence/routine grants for anon/authenticated/
-- service_role.
--
-- Every table in this schema relies on RLS policies to restrict access, but
-- RLS only ever *narrows* what an already-GRANTed role may do — Postgres
-- still checks ordinary object privileges first, independent of a role's
-- BYPASSRLS flag. Some hosting platforms apply these grants automatically
-- during provisioning; a *fresh* Postgres (a new local dev instance, a
-- disaster-recovery restore, or CI) does not, and the migrations would fail
-- there with "permission denied for table X" even for the service role.
-- Making the grants explicit here makes the schema fully self-contained and
-- reprovisionable from scratch.
grant usage on schema public to anon, authenticated, service_role;
grant all on all tables in schema public to anon, authenticated, service_role;
grant all on all sequences in schema public to anon, authenticated, service_role;
grant all on all routines in schema public to anon, authenticated, service_role;
alter default privileges in schema public grant all on tables to anon, authenticated, service_role;
alter default privileges in schema public grant all on sequences to anon, authenticated, service_role;
alter default privileges in schema public grant all on routines to anon, authenticated, service_role;