Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
144e7e45ae
commit
be07ab2fa3
@@ -0,0 +1,43 @@
|
||||
create table if not exists public.smtp_settings (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
host text not null,
|
||||
port integer not null default 587,
|
||||
secure boolean not null default false,
|
||||
username text,
|
||||
from_email text not null,
|
||||
from_name text,
|
||||
reply_to text,
|
||||
enabled boolean not null default true,
|
||||
notes text,
|
||||
created_at timestamptz not null default now(),
|
||||
updated_at timestamptz not null default now(),
|
||||
updated_by uuid
|
||||
);
|
||||
|
||||
alter table public.smtp_settings enable row level security;
|
||||
|
||||
create policy "Admins can read smtp settings"
|
||||
on public.smtp_settings for select
|
||||
to authenticated
|
||||
using (public.is_admin(auth.uid()));
|
||||
|
||||
create policy "Admins can insert smtp settings"
|
||||
on public.smtp_settings for insert
|
||||
to authenticated
|
||||
with check (public.is_admin(auth.uid()));
|
||||
|
||||
create policy "Admins can update smtp settings"
|
||||
on public.smtp_settings for update
|
||||
to authenticated
|
||||
using (public.is_admin(auth.uid()))
|
||||
with check (public.is_admin(auth.uid()));
|
||||
|
||||
create policy "Admins can delete smtp settings"
|
||||
on public.smtp_settings for delete
|
||||
to authenticated
|
||||
using (public.is_admin(auth.uid()));
|
||||
|
||||
drop trigger if exists trg_smtp_settings_updated_at on public.smtp_settings;
|
||||
create trigger trg_smtp_settings_updated_at
|
||||
before update on public.smtp_settings
|
||||
for each row execute function public.tg_set_updated_at();
|
||||
Reference in New Issue
Block a user