Skip to content

Commit

Permalink
Update db user permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
NickPhura committed Nov 17, 2023
1 parent 46daa6e commit 7d4ac94
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions database/src/migrations/20220225205948_release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,25 @@ export async function up(knex: Knex): Promise<void> {
-- setup postgres user
GRANT ALL ON SCHEMA biohub TO postgres;
set search_path = biohub, public, topology;
set search_path = biohub, public;
-- setup api user
-- setup biohub_api user
create user ${DB_USER_API} password '${DB_USER_API_PASS}';
GRANT ALL ON SCHEMA biohub TO ${DB_USER_API};
alter role ${DB_USER_API} set search_path to biohub, public, topology;
-- GRANT ALL ON SCHEMA biohub TO ${DB_USER_API};
-- GRANT ALL ON ALL TABLES IN SCHEMA biohub TO ${DB_USER_API};
alter role ${DB_USER_API} set search_path to "$user", biohub, public;
ALTER DEFAULT PRIVILEGES IN SCHEMA biohub, public
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO biohub_api;
ALTER DEFAULT PRIVILEGES IN SCHEMA biohub, public
GRANT EXECUTE ON FUNCTIONS TO biohub_api;
ALTER DEFAULT PRIVILEGES IN SCHEMA biohub, public
GRANT USAGE ON TYPES TO biohub_api;
ALTER DEFAULT PRIVILEGES IN SCHEMA biohub, public
GRANT USAGE, SELECT ON SEQUENCES TO biohub_api;
${biohub_ddl}
${populate_user_identity_source}
Expand All @@ -93,7 +106,6 @@ export async function up(knex: Knex): Promise<void> {
${create_sequences}
-- populate look up tables
set search_path = biohub, public;
${populate_system_constants}
${populate_system_role}
${populate_system_metadata_constant}
Expand Down

0 comments on commit 7d4ac94

Please sign in to comment.