Merge lp:~thumper/launchpad/code-email-permissions into lp:launchpad/db-devel

Proposed by Tim Penhey
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~thumper/launchpad/code-email-permissions
Merge into: lp:launchpad/db-devel
Diff against target: 51 lines (+30/-0)
2 files modified
database/schema/security.cfg (+1/-0)
lib/lp/code/mail/tests/test_codehandler.py (+29/-0)
To merge this branch: bzr merge lp:~thumper/launchpad/code-email-permissions
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Review via email: mp+24390@code.launchpad.net

Commit message

Add codeimport to the select permissions for processmail.

Description of the change

Add a missing db permission for people trying to approve a branch using email.

tests:
  test_process_for_imported_branch

No pre-impl call, somewhat trivial.

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Yes, seems fine. I'm not entirely sure this bit:

25 + The permission check needs to fall through from the owner, that is why
26 + we are using a non-reviewer for this test.

makes complete sense, can you expand it a bit?

Thanks for doing this and cooking up the test though :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2010-04-23 11:19:49 +0000
+++ database/schema/security.cfg 2010-04-29 03:34:33 +0000
@@ -1501,6 +1501,7 @@
1501public.branchsubscription = SELECT, INSERT1501public.branchsubscription = SELECT, INSERT
1502public.branchvisibilitypolicy = SELECT1502public.branchvisibilitypolicy = SELECT
1503public.bugbranch = SELECT1503public.bugbranch = SELECT
1504public.codeimport = SELECT
1504public.codereviewmessage = SELECT, INSERT1505public.codereviewmessage = SELECT, INSERT
1505public.codereviewvote = SELECT, INSERT, UPDATE1506public.codereviewvote = SELECT, INSERT, UPDATE
1506public.diff = SELECT, INSERT, UPDATE1507public.diff = SELECT, INSERT, UPDATE
15071508
=== modified file 'lib/lp/code/mail/tests/test_codehandler.py'
--- lib/lp/code/mail/tests/test_codehandler.py 2010-04-23 08:33:14 +0000
+++ lib/lp/code/mail/tests/test_codehandler.py 2010-04-29 03:34:33 +0000
@@ -245,6 +245,35 @@
245 self.assertEqual(245 self.assertEqual(
246 mail['Reply-to'], self.code_handler._getReplyAddress(mail))246 mail['Reply-to'], self.code_handler._getReplyAddress(mail))
247247
248 def test_process_for_imported_branch(self):
249 """Make sure that the database user is able refer to import branches.
250
251 Import branches have different permission checks than other branches.
252
253 Permission to mark a merge proposal as approved checks launchpad.Edit
254 of the target branch, or membership of the review team on the target
255 branch. For import branches launchpad.Edit also checks the registrant
256 of the code import if there is one, and membership of vcs-imports. So
257 if someone is attempting to review something on an import branch, but
258 they don't have launchpad.Edit but are a member of the review team,
259 then a check against the code import is done.
260 """
261 mail = self.factory.makeSignedMessage(body=' merge approved')
262 code_import = self.factory.makeCodeImport()
263 bmp = self.factory.makeBranchMergeProposal(
264 target_branch=code_import.branch)
265 email_addr = bmp.address
266 self.switchDbUser(config.processmail.dbuser)
267 pop_notifications()
268 self.code_handler.process(mail, email_addr, None)
269 notification = pop_notifications()[0]
270 # The returned message is a multipart message, the first part is
271 # the message, and the second is the original message.
272 message, original = notification.get_payload()
273 self.assertTrue(
274 "You are not a reviewer for the branch" in
275 message.get_payload(decode=True))
276
248 def test_processVote(self):277 def test_processVote(self):
249 """Process respects the vote command."""278 """Process respects the vote command."""
250 mail = self.factory.makeSignedMessage(body=' vote Abstain EBAILIWICK')279 mail = self.factory.makeSignedMessage(body=' vote Abstain EBAILIWICK')

Subscribers

People subscribed via source and target branches

to status/vote changes: