Skip to content

Commit

Permalink
New role for importing data
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlLevik committed Jan 20, 2020
1 parent c0b327f commit b85a8ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ then
mysql --defaults-file=.my.cnf -D $db < grants/ispyb_acquisition.sql
mysql --defaults-file=.my.cnf -D $db < grants/ispyb_processing.sql
mysql --defaults-file=.my.cnf -D $db < grants/ispyb_web.sql
mysql --defaults-file=.my.cnf -D $db < grants/ispyb_import.sql

# Verify that all update .sql files have been run, if not exit with message
all_sql_files=`cd schema/updates && ls *.sql && cd ../..`
Expand Down
15 changes: 15 additions & 0 deletions grants/ispyb_import.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Create the import application role.
CREATE ROLE IF NOT EXISTS ispyb_import;

-- You must also create a database user and grant this role to them, e.g.
-- CREATE USER ispyb_uo@'%' IDENTIFIED BY 'the_uo_password';
-- GRANT ispyb_import TO ispyb_uo@'%';
-- SET DEFAULT ROLE ispyb_import FOR ispyb_uo@'%';

-- Grants for ispyb_processing
GRANT SELECT ON AdminVar TO 'ispyb_import'; -- Hack TO allow ispyb_import to connect through MaxScale
GRANT EXECUTE ON PROCEDURE retrieve_container_for_barcode TO 'ispyb_import';
GRANT EXECUTE ON PROCEDURE retrieve_container_for_inspection_id TO 'ispyb_import';
GRANT EXECUTE ON PROCEDURE retrieve_sample_for_container_id_and_location TO 'ispyb_import';
GRANT EXECUTE ON PROCEDURE upsert_sample_image TO 'ispyb_import';
GRANT EXECUTE ON PROCEDURE upsert_sample_image_auto_score TO 'ispyb_import';

0 comments on commit b85a8ff

Please sign in to comment.