camper/deploy/roles.sql

29 lines
496 B
MySQL
Raw Normal View History

-- Deploy camper:roles to pg
begin;
do
$$
declare
role name;
roles name[] := array ['guest', 'employee', 'admin', 'authenticator'];
begin
foreach role in array roles
loop
begin
execute 'create role ' || role || ' noinherit nologin';
exception
when duplicate_object then
raise notice '%, skipping', sqlerrm using errcode = sqlstate;
end;
end loop;
end
$$;
grant guest to authenticator;
grant employee to authenticator;
grant admin to authenticator;
commit;