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
=== modified file 'lib/canonical/launchpad/security.py'
--- lib/canonical/launchpad/security.py 2010-09-14 18:28:53 +0000
+++ lib/canonical/launchpad/security.py 2010-10-07 16:52:48 +0000
@@ -893,7 +893,8 @@
893 usedfor = IDistributionSourcePackage893 usedfor = IDistributionSourcePackage
894894
895 def checkAuthenticated(self, user):895 def checkAuthenticated(self, user):
896 return (user.inTeam(self.obj.distribution.owner) or896 return (user.inTeam(self.obj.distribution.bug_supervisor) or
897 user.inTeam(self.obj.distribution.owner) or
897 user.in_admin)898 user.in_admin)
898899
899900
900901
=== modified file 'lib/lp/bugs/model/bugtarget.py'
--- lib/lp/bugs/model/bugtarget.py 2010-09-21 09:37:06 +0000
+++ lib/lp/bugs/model/bugtarget.py 2010-10-07 16:52:48 +0000
@@ -332,7 +332,7 @@
332class OfficialBugTagTargetMixin:332class OfficialBugTagTargetMixin:
333 """See `IOfficialBugTagTarget`.333 """See `IOfficialBugTagTarget`.
334334
335 This class is inteneded to be used as a mixin for the classes335 This class is intended to be used as a mixin for the classes
336 Distribution, Product and ProjectGroup, which can define official336 Distribution, Product and ProjectGroup, which can define official
337 bug tags.337 bug tags.
338338
339339
=== modified file 'lib/lp/registry/browser/tests/test_edit_permissions.py'
--- lib/lp/registry/browser/tests/test_edit_permissions.py 2010-08-20 20:31:18 +0000
+++ lib/lp/registry/browser/tests/test_edit_permissions.py 2010-10-07 16:52:48 +0000
@@ -75,23 +75,48 @@
7575
7676
77class ProductEditViewPermissionTestCase(EditViewPermissionBase):77class ProductEditViewPermissionTestCase(EditViewPermissionBase):
78 """Tests for permissions to access prodcut +edit page."""78 """Tests for permissions to access product +edit page."""
79 def setupTarget(self):79 def setupTarget(self):
80 self.target = self.factory.makeProduct()80 self.target = self.factory.makeProduct()
8181
8282
83class ProjectEditViewPermissionTestCase(EditViewPermissionBase):83class ProjectEditViewPermissionTestCase(EditViewPermissionBase):
84 """Tests for permissions to access prodcut +edit page."""84 """Tests for permissions to access product +edit page."""
85 def setupTarget(self):85 def setupTarget(self):
86 self.target = self.factory.makeProject()86 self.target = self.factory.makeProject()
8787
8888
89class DistributionEditViewPermissionTestCase(EditViewPermissionBase):89class DistributionEditViewPermissionTestCase(EditViewPermissionBase):
90 """Tests for permissions to access prodcut +edit page."""90 """Tests for permissions to access product +edit page."""
91 def setupTarget(self):91 def setupTarget(self):
92 self.target = self.factory.makeDistribution()92 self.target = self.factory.makeDistribution()
9393
9494
95class DistroSourcePackageEditViewPermissionTestCase(EditViewPermissionBase):
96 """Test for permissions to access a distribution source package
97 +edit page."""
98
99 def setupTarget(self):
100 self.d_owner = self.factory.makePerson()
101 login_person(self.d_owner)
102 self.distro = self.factory.makeDistribution(name='youbuntu',
103 owner=self.d_owner)
104 self.target = self.factory.makeDistributionSourcePackage(
105 distribution=self.distro)
106 self.supervisor_team = self.factory.makeTeam(
107 owner=self.d_owner)
108 self.supervisor_member = self.factory.makePerson()
109 self.supervisor_team.addMember(
110 self.supervisor_member, self.d_owner)
111 self.distro.setBugSupervisor(
112 self.supervisor_team, self.d_owner)
113
114 def test_bug_supervisor_can_edit(self):
115 login_person(self.supervisor_member)
116 view = create_initialized_view(self.target, '+edit')
117 self.assertTrue(check_permission('launchpad.Edit', view))
118
119
95def test_suite():120def test_suite():
96 suite = unittest.TestSuite()121 suite = unittest.TestSuite()
97 suite.addTest(unittest.TestLoader().loadTestsFromName(__name__))122 suite.addTest(unittest.TestLoader().loadTestsFromName(__name__))