[PATCH] lib/sql: Update grant script for recent schema changes

Jeremy Kerr jk at ozlabs.org
Tue Apr 14 15:57:53 AEST 2020


This change fixes a few omissions in the grant scripts:

- patchrelation is missing from both mysql and postgres scripts; it's
  only needed for web user access.

- event is missing from the web grants on postgres, and the mail grants
  on mysql.

Tested on postgres only.

Fixes: 27c2acf56c ("models, templates: Add patch relations")
Fixes: 34e3c9c493 ("sql: Update 'grant-all.mysql' script with missing tables")
Fixes: 234bc7c316 ("lib/sql: fix permissions for v2.0.0 on postgres")
Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
---
 lib/sql/grant-all.mysql.sql    | 2 ++
 lib/sql/grant-all.postgres.sql | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/lib/sql/grant-all.mysql.sql b/lib/sql/grant-all.mysql.sql
index 0277077..100cd38 100644
--- a/lib/sql/grant-all.mysql.sql
+++ b/lib/sql/grant-all.mysql.sql
@@ -23,6 +23,7 @@ GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_emailoptout TO 'www-data'@loca
 GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_event TO 'www-data'@localhost;
 GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_patch TO 'www-data'@localhost;
 GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_patchchangenotification TO 'www-data'@localhost;
+GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_patchrelation TO 'www-data'@localhost;
 GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_patchtag TO 'www-data'@localhost;
 GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_person TO 'www-data'@localhost;
 GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_project TO 'www-data'@localhost;
@@ -38,6 +39,7 @@ GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_userprofile_maintainer_project
 -- cover letters) and series
 GRANT INSERT, SELECT ON patchwork_comment TO 'nobody'@localhost;
 GRANT INSERT, SELECT ON patchwork_coverletter TO 'nobody'@localhost;
+GRANT INSERT, SELECT ON patchwork_event TO 'nobody'@localhost;
 GRANT INSERT, SELECT ON patchwork_patch TO 'nobody'@localhost;
 GRANT INSERT, SELECT ON patchwork_person TO 'nobody'@localhost;
 GRANT INSERT, SELECT ON patchwork_series TO 'nobody'@localhost;
diff --git a/lib/sql/grant-all.postgres.sql b/lib/sql/grant-all.postgres.sql
index 10ec8d2..56a2486 100644
--- a/lib/sql/grant-all.postgres.sql
+++ b/lib/sql/grant-all.postgres.sql
@@ -21,8 +21,10 @@ GRANT SELECT, UPDATE, INSERT, DELETE ON
 	patchwork_delegationrule,
 	patchwork_emailconfirmation,
 	patchwork_emailoptout,
+	patchwork_event,
 	patchwork_patch,
 	patchwork_patchchangenotification,
+	patchwork_patchrelation,
 	patchwork_patchtag,
 	patchwork_person,
 	patchwork_project,
@@ -50,7 +52,9 @@ GRANT SELECT, UPDATE ON
 	patchwork_comment_id_seq,
 	patchwork_delegationrule_id_seq,
 	patchwork_emailconfirmation_id_seq,
+	patchwork_event_id_seq,
 	patchwork_patch_id_seq,
+	patchwork_patchrelation_id_seq,
 	patchwork_patchtag_id_seq,
 	patchwork_person_id_seq,
 	patchwork_project_id_seq,
-- 
2.17.1



More information about the Patchwork mailing list