Merge lp:~brian-murray/launchpad/bug-supervisor-permissions into lp:launchpad

Proposed by Brian Murray
Status: Merged
Approved by: Brian Murray
Approved revision: no longer in the source branch.
Merged at revision: 11690
Proposed branch: lp:~brian-murray/launchpad/bug-supervisor-permissions
Merge into: lp:launchpad
Diff against target: 82 lines (+31/-5)
3 files modified
lib/canonical/launchpad/security.py (+2/-1)
lib/lp/bugs/model/bugtarget.py (+1/-1)
lib/lp/registry/browser/tests/test_edit_permissions.py (+28/-3)
To merge this branch: bzr merge lp:~brian-murray/launchpad/bug-supervisor-permissions
Reviewer Review Type Date Requested Status
Māris Fogels (community) Approve
Review via email: mp+37514@code.launchpad.net

Commit message

Allow a distribution's bug supervisor to set source package bug reporting guidelines and acknowledgment.

Description of the change

This branch grants the distribution bug supervisor the ability to edit distribution source package's +edit page. This allows them to set the package's bug reporting guidelines and bug reporting acknowledgment.

A test for this was added to test_edit_permissions.py.

bin/test -cvvt test_edit_permissions

To post a comment you must log in.
Revision history for this message
Māris Fogels (mars) wrote :

This is a great change. The test helpers make the change very clean and readable. r=mars

One suggestion for readability: consider renaming self.target and setupTarget() to something like self.context and setupViewContext(). I had to open the base class docstring to understand what the 'target' created by setupTarget actually is.

Maris

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/security.py'
2--- lib/canonical/launchpad/security.py 2010-09-14 18:28:53 +0000
3+++ lib/canonical/launchpad/security.py 2010-10-07 16:52:48 +0000
4@@ -893,7 +893,8 @@
5 usedfor = IDistributionSourcePackage
6
7 def checkAuthenticated(self, user):
8- return (user.inTeam(self.obj.distribution.owner) or
9+ return (user.inTeam(self.obj.distribution.bug_supervisor) or
10+ user.inTeam(self.obj.distribution.owner) or
11 user.in_admin)
12
13
14
15=== modified file 'lib/lp/bugs/model/bugtarget.py'
16--- lib/lp/bugs/model/bugtarget.py 2010-09-21 09:37:06 +0000
17+++ lib/lp/bugs/model/bugtarget.py 2010-10-07 16:52:48 +0000
18@@ -332,7 +332,7 @@
19 class OfficialBugTagTargetMixin:
20 """See `IOfficialBugTagTarget`.
21
22- This class is inteneded to be used as a mixin for the classes
23+ This class is intended to be used as a mixin for the classes
24 Distribution, Product and ProjectGroup, which can define official
25 bug tags.
26
27
28=== modified file 'lib/lp/registry/browser/tests/test_edit_permissions.py'
29--- lib/lp/registry/browser/tests/test_edit_permissions.py 2010-08-20 20:31:18 +0000
30+++ lib/lp/registry/browser/tests/test_edit_permissions.py 2010-10-07 16:52:48 +0000
31@@ -75,23 +75,48 @@
32
33
34 class ProductEditViewPermissionTestCase(EditViewPermissionBase):
35- """Tests for permissions to access prodcut +edit page."""
36+ """Tests for permissions to access product +edit page."""
37 def setupTarget(self):
38 self.target = self.factory.makeProduct()
39
40
41 class ProjectEditViewPermissionTestCase(EditViewPermissionBase):
42- """Tests for permissions to access prodcut +edit page."""
43+ """Tests for permissions to access product +edit page."""
44 def setupTarget(self):
45 self.target = self.factory.makeProject()
46
47
48 class DistributionEditViewPermissionTestCase(EditViewPermissionBase):
49- """Tests for permissions to access prodcut +edit page."""
50+ """Tests for permissions to access product +edit page."""
51 def setupTarget(self):
52 self.target = self.factory.makeDistribution()
53
54
55+class DistroSourcePackageEditViewPermissionTestCase(EditViewPermissionBase):
56+ """Test for permissions to access a distribution source package
57+ +edit page."""
58+
59+ def setupTarget(self):
60+ self.d_owner = self.factory.makePerson()
61+ login_person(self.d_owner)
62+ self.distro = self.factory.makeDistribution(name='youbuntu',
63+ owner=self.d_owner)
64+ self.target = self.factory.makeDistributionSourcePackage(
65+ distribution=self.distro)
66+ self.supervisor_team = self.factory.makeTeam(
67+ owner=self.d_owner)
68+ self.supervisor_member = self.factory.makePerson()
69+ self.supervisor_team.addMember(
70+ self.supervisor_member, self.d_owner)
71+ self.distro.setBugSupervisor(
72+ self.supervisor_team, self.d_owner)
73+
74+ def test_bug_supervisor_can_edit(self):
75+ login_person(self.supervisor_member)
76+ view = create_initialized_view(self.target, '+edit')
77+ self.assertTrue(check_permission('launchpad.Edit', view))
78+
79+
80 def test_suite():
81 suite = unittest.TestSuite()
82 suite.addTest(unittest.TestLoader().loadTestsFromName(__name__))