Merge ~cjwatson/lp-signing:db-grants into lp-signing:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 1f4569e8df55efa937da1e2445eeac53791b5c3f
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/lp-signing:db-grants
Merge into: lp-signing:master
Diff against target: 87 lines (+22/-8)
6 files modified
Makefile.db (+3/-3)
lp_signing/config.py (+1/-1)
lp_signing/database/tests/test_enumcol.py (+2/-2)
lp_signing/tests/test_webapp.py (+1/-1)
migrations/patch-0-1-1-std.sql (+14/-0)
service.conf (+1/-1)
Reviewer Review Type Date Requested Status
Tom Wardill (community) Approve
Review via email: mp+382581@code.launchpad.net

Commit message

Grant the application access to database tables

Description of the change

Otherwise it can't do very much.

To post a comment you must log in.
Revision history for this message
Tom Wardill (twom) :
review: Approve
Revision history for this message
Otto Co-Pilot (otto-copilot) wrote :
Revision history for this message
Otto Co-Pilot (otto-copilot) wrote :
~cjwatson/lp-signing:db-grants updated
1f4569e... by Colin Watson

Fix local DB name in config and tests

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile.db b/Makefile.db
2index dd8d4c7..980a815 100644
3--- a/Makefile.db
4+++ b/Makefile.db
5@@ -1,7 +1,7 @@
6-PGNAME = lp_signing
7+PGNAME = lp-signing
8 PGHOST = $(shell pwd)/dev-db/localhost
9-PGUSER = lp_signing
10-PGUSER_ADMIN = lp_signing_admin
11+PGUSER = lp-signing
12+PGUSER_ADMIN = lp-signing_admin
13 DATA_DIR = $(PGHOST)/data
14 LOG_FILE = $(PGHOST)/postgresql.log
15 CONF_FILE = $(PGHOST)/postgresql.conf
16diff --git a/lp_signing/config.py b/lp_signing/config.py
17index 2c4036b..be8403a 100644
18--- a/lp_signing/config.py
19+++ b/lp_signing/config.py
20@@ -21,7 +21,7 @@ _test_db_path = str(ROOT / "dev-db" / "localhost")
21
22 DEFAULT_TEST_CONFIG = {
23 "database": {
24- "master_url": f"postgres://{quote(_test_db_path, safe='')}/lp_signing",
25+ "master_url": f"postgres://{quote(_test_db_path, safe='')}/lp-signing",
26 "standby_urls": "[]",
27 },
28 "auth": {
29diff --git a/lp_signing/database/tests/test_enumcol.py b/lp_signing/database/tests/test_enumcol.py
30index ac65e30..ea5ba1f 100644
31--- a/lp_signing/database/tests/test_enumcol.py
32+++ b/lp_signing/database/tests/test_enumcol.py
33@@ -69,8 +69,8 @@ class TestDBEnum(TestCase):
34 foo integer DEFAULT 1 NOT NULL
35 );
36 """)
37- store.execute("GRANT ALL ON TABLE FooTest TO lp_signing;")
38- store.execute("GRANT ALL ON footest_id_seq TO lp_signing;")
39+ store.execute('GRANT ALL ON TABLE FooTest TO "lp-signing";')
40+ store.execute('GRANT ALL ON footest_id_seq TO "lp-signing";')
41 self.addCleanup(store.execute, "DROP TABLE FooTest;")
42
43 def test_enumerated_type_must_be_DBEnumeratedType(self):
44diff --git a/lp_signing/tests/test_webapp.py b/lp_signing/tests/test_webapp.py
45index b555463..9857263 100644
46--- a/lp_signing/tests/test_webapp.py
47+++ b/lp_signing/tests/test_webapp.py
48@@ -53,7 +53,7 @@ class TestConfiguration(TestCase):
49 MatchesStructure.byEquality(
50 scheme="postgres",
51 hostname=quote(str(root / "dev-db" / "localhost"), safe=""),
52- path="/lp_signing"))
53+ path="/lp-signing"))
54
55 def test_binds_no_standbys(self):
56 fixture = self.useFixture(AppFixture())
57diff --git a/migrations/patch-0-1-1-std.sql b/migrations/patch-0-1-1-std.sql
58new file mode 100644
59index 0000000..6d0b462
60--- /dev/null
61+++ b/migrations/patch-0-1-1-std.sql
62@@ -0,0 +1,14 @@
63+GRANT SELECT, INSERT, UPDATE, DELETE ON nonce TO "lp-signing";
64+GRANT USAGE ON nonce_id_seq TO "lp-signing";
65+
66+GRANT SELECT, INSERT, UPDATE, DELETE ON client TO "lp-signing";
67+GRANT USAGE ON client_id_seq TO "lp-signing";
68+
69+GRANT SELECT, INSERT, UPDATE, DELETE ON clientpublickey TO "lp-signing";
70+GRANT USAGE ON clientpublickey_id_seq TO "lp-signing";
71+
72+GRANT SELECT, INSERT, UPDATE, DELETE ON key TO "lp-signing";
73+GRANT USAGE ON key_id_seq TO "lp-signing";
74+
75+GRANT SELECT, INSERT, UPDATE, DELETE ON keyauthorization TO "lp-signing";
76+GRANT USAGE ON keyauthorization_id_seq TO "lp-signing";
77diff --git a/service.conf b/service.conf
78index ea0de24..8751c72 100644
79--- a/service.conf
80+++ b/service.conf
81@@ -1,5 +1,5 @@
82 [database]
83-master_url: postgres://%(QUOTED_TEST_DB_PATH)s/lp_signing
84+master_url: postgres://%(QUOTED_TEST_DB_PATH)s/lp-signing
85 standby_urls: []
86
87 [auth]

Subscribers

People subscribed via source and target branches