Skip to content

Commit

Permalink
EBI view for data-out
Browse files Browse the repository at this point in the history
  • Loading branch information
silverdaz committed Nov 7, 2018
1 parent ee4ea16 commit 72a4108
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
1 change: 0 additions & 1 deletion deploy/images/db/download.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ SELECT id,
FROM local_ega.main
WHERE status = 'READY';


-- Insert new request, and return some vault information
CREATE TYPE request_type AS (req_id INTEGER,
header TEXT,
Expand Down
15 changes: 15 additions & 0 deletions deploy/images/db/ebi.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- SET search_path TO local_ega_download;

-- Used by EBI
CREATE VIEW local_ega_download.ebi_files AS
SELECT stable_id AS file_id,
CASE
WHEN (vault_file_type = 'S3') THEN 's3://'
ELSE 'file://' -- enum: if not s3, then it's POSIX
END || vault_file_reference AS file_name,
vault_file_size AS file_size,
header AS header,
vault_file_checksum AS unencrypted_checksum,
vault_file_checksum_type AS unencrypted_checksum_type
FROM local_ega.main
WHERE status = 'READY';
1 change: 1 addition & 0 deletions deploy/images/db/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ EOSQL
# Run sql commands (in order!)
DB_FILES=(/docker-entrypoint-initdb.d/main.sql
/docker-entrypoint-initdb.d/download.sql
/docker-entrypoint-initdb.d/ebi.sql
/docker-entrypoint-initdb.d/qc.sql
/docker-entrypoint-initdb.d/grants.sql)

Expand Down
8 changes: 4 additions & 4 deletions deploy/images/db/grants.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ CREATE USER lega_in;
CREATE USER lega_out;

-- Set up rights access for local_ega schema
GRANT USAGE ON SCHEMA local_ega TO lega_in, lega_out;
GRANT USAGE ON SCHEMA local_ega TO lega_in;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA local_ega TO lega_in; -- Read/Write access on local_ega.* for lega_in
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA local_ega TO lega_in; -- Don't forget the sequences

-- Set up rights access for audit schema
-- Set up rights access for download schema
GRANT USAGE ON SCHEMA local_ega_download TO lega_out;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA local_ega_download TO lega_out; -- Read/Write on audit.* for lega_out
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA local_ega_download TO lega_out; -- Read/Write on local_ega_download.* for lega_out
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA local_ega_download TO lega_out; -- Don't forget the sequences

GRANT SELECT ON local_ega.main TO lega_out; -- Read-Only access for lega_out, through the view local_ega_download.files
GRANT SELECT ON local_ega.main TO lega_out; -- Read-Only access for lega_out, through the views inside local_ega_download

0 comments on commit 72a4108

Please sign in to comment.