From ae4e245d7d6b13ed994c313bea8a4625737673cd Mon Sep 17 00:00:00 2001 From: deoren Date: Thu, 4 Apr 2019 18:21:12 -0500 Subject: [PATCH] Update table join, SQL user privileges query - Update INNER JOIN to reference the correct table - Update SQL file to grant intended privileges on correct table/field refs #36 --- automated_tickets.ini | 2 +- sql/create_users.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/automated_tickets.ini b/automated_tickets.ini index d04cb2a..00b38d9 100644 --- a/automated_tickets.ini +++ b/automated_tickets.ini @@ -104,7 +104,7 @@ default_to_address = automated-tickets@localhost # Pull wiki page contents from Redmine database # The wiki_pages.title value is the name of the page as shown in the URL # The project.identifier value is the project "shortname", shown in the URL -wiki_page_contents = SELECT wiki_contents.text FROM wiki_contents INNER JOIN wiki_pages ON wiki_pages.id = wiki_contents.id INNER JOIN wikis ON wikis.id = wiki_pages.wiki_id INNER JOIN projects ON projects.id = wikis.project_id WHERE wiki_pages.title = '{}' AND projects.identifier = '{}' +wiki_page_contents = SELECT wiki_contents.text FROM wiki_contents INNER JOIN wiki_pages ON wiki_pages.id = wiki_contents.page_id INNER JOIN wikis ON wikis.id = wiki_pages.wiki_id INNER JOIN projects ON projects.id = wikis.project_id WHERE wiki_pages.title = '{}' AND projects.identifier = '{}' # The query needed to pull event table entries. As is, this query does not limit # the returned results by event schedule or whether the flag is set for diff --git a/sql/create_users.sql b/sql/create_users.sql index 6274520..4f9c122 100644 --- a/sql/create_users.sql +++ b/sql/create_users.sql @@ -34,7 +34,7 @@ GRANT SELECT,LOCK TABLES ON event_reminders.* TO 'events_ro'@'localhost'; -- the Redmine database. See the query in the automated_tickets.ini config -- file for how these columns are used. GRANT SELECT(text) ON redmine.wiki_contents TO 'events_ro'@'localhost'; -GRANT SELECT(id) ON redmine.wiki_contents TO 'events_ro'@'localhost'; +GRANT SELECT(page_id) ON redmine.wiki_contents TO 'events_ro'@'localhost'; GRANT SELECT(id) ON redmine.wiki_pages TO 'events_ro'@'localhost'; GRANT SELECT(wiki_id) ON redmine.wiki_pages TO 'events_ro'@'localhost';