57 lines
2.6 KiB
SQL
57 lines
2.6 KiB
SQL
-- ====================================================================
|
|
-- 0058_legal_pages — Impressum + Datenschutzerklärung (öffentlich)
|
|
-- ====================================================================
|
|
-- Rechtliche Pflichtseiten: Impressum (§ 5 DDG) rendert die App künftig
|
|
-- automatisch aus diesen Stammdaten, die Datenschutzerklärung (Art. 13
|
|
-- DSGVO) aus einem pro Instanz editierbaren HTML-Feld (mit Vorlage als
|
|
-- Fallback). White-Label: jeder Mandant ist eigener Diensteanbieter und
|
|
-- pflegt seine eigenen Angaben.
|
|
--
|
|
-- Alle Spalten sind KEINE Geheimnisse — die öffentlichen Seiten lesen
|
|
-- site_settings via anon. Der Grant unten (Muster 0043/0056) macht sie
|
|
-- automatisch anon-lesbar (Block-Liste = bisherige Geheimnisse).
|
|
|
|
alter table public.site_settings
|
|
-- Anschrift des Diensteanbieters (Impressum)
|
|
add column if not exists company_street text,
|
|
add column if not exists company_postal_code text,
|
|
add column if not exists company_city text,
|
|
-- Kontakt (Impressum: schnelle elektronische Kontaktaufnahme)
|
|
add column if not exists contact_email text,
|
|
add column if not exists contact_phone text,
|
|
-- Zuständige Aufsichtsbehörde (falls einschlägig)
|
|
add column if not exists supervisory_authority text,
|
|
-- Datenschutzbeauftragte:r (Art. 37 DSGVO — bei öffentlichen Stellen Pflicht)
|
|
add column if not exists dpo_name text,
|
|
add column if not exists dpo_contact text,
|
|
-- Freitext-HTML: editierbare Datenschutzerklärung + optionaler
|
|
-- Impressum-Zusatz (z.B. Haftungsausschluss, Bildnachweise).
|
|
add column if not exists privacy_policy_html text,
|
|
add column if not exists imprint_extra_html text;
|
|
|
|
-- anon-Spalten-Grant neu setzen (Muster 0056): die neuen Rechts-Spalten
|
|
-- sind KEINE Geheimnisse. Block-Liste bleibt unverändert → neue Spalten
|
|
-- werden automatisch anon-lesbar.
|
|
revoke all on public.site_settings from anon;
|
|
|
|
do $$
|
|
declare
|
|
v_cols text;
|
|
begin
|
|
select string_agg(quote_ident(column_name), ', ')
|
|
into v_cols
|
|
from information_schema.columns
|
|
where table_schema = 'public'
|
|
and table_name = 'site_settings'
|
|
and column_name not in (
|
|
'ai_anthropic_key', 'ai_openai_key', 'ai_openrouter_key',
|
|
'apple_pass_cert_p12', 'apple_pass_passphrase', 'apple_pass_type_id',
|
|
'google_wallet_service_account_json',
|
|
'phone_api_token', 'phone_lookup_token', 'phone_webhook_secret',
|
|
'license_key',
|
|
'smtp_host', 'smtp_port', 'smtp_secure', 'smtp_user', 'smtp_pass',
|
|
'smtp_from_email', 'smtp_from_name'
|
|
);
|
|
execute 'grant select (' || v_cols || ') on public.site_settings to anon';
|
|
end $$;
|