tipus/deploy/roles.sql

28 lines
634 B
MySQL
Raw Normal View History

-- Deploy tipus:roles to pg
begin;
do
$$
declare
role name;
roles name[] := array ['guest', 'publisher', '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 publisher to authenticator;
grant admin to authenticator;
commit;