← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Brian Murray has proposed merging lp:~brian-murray/launchpad/bug-supervisor-permissions into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #654795 bug reporting guidelines and acknowledgement should be editable by bug supervisor
  https://bugs.launchpad.net/bugs/654795


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
-- 
https://code.launchpad.net/~brian-murray/launchpad/bug-supervisor-permissions/+merge/37514
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~brian-murray/launchpad/bug-supervisor-permissions into lp:launchpad/devel.
=== modified file 'lib/canonical/launchpad/mailnotification.py'
--- lib/canonical/launchpad/mailnotification.py	2010-09-07 14:26:29 +0000
+++ lib/canonical/launchpad/mailnotification.py	2010-10-04 20:04:35 +0000
@@ -146,6 +146,7 @@
     text_diff = '\n'.join(text_diff)
     return text_diff
 
+    bug.getDirectSubscriptions
 
 @block_implicit_flushes
 def notify_invitation_to_join_team(event):

=== 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-04 20:04:35 +0000
@@ -893,7 +893,8 @@
     usedfor = IDistributionSourcePackage
 
     def checkAuthenticated(self, user):
-        return (user.inTeam(self.obj.distribution.owner) or
+        return (user.inTeam(self.obj.distribution.bug_supervisor) or
+                user.inTeam(self.obj.distribution.owner) or
                 user.in_admin)
 
 

=== 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-04 20:04:35 +0000
@@ -332,7 +332,7 @@
 class OfficialBugTagTargetMixin:
     """See `IOfficialBugTagTarget`.
 
-    This class is inteneded to be used as a mixin for the classes
+    This class is intended to be used as a mixin for the classes
     Distribution, Product and ProjectGroup, which can define official
     bug tags.
 

=== modified file 'lib/lp/bugs/tests/test_bugnotification.py'
--- lib/lp/bugs/tests/test_bugnotification.py	2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/tests/test_bugnotification.py	2010-10-04 20:04:35 +0000
@@ -127,6 +127,7 @@
             [self.product.owner.preferredemail.email,
              self.subscriber.preferredemail.email],
             [mail['To'] for mail in pop_notifications()])
+        person.getSubscriptions()
 
 
 class TestNotificationProcessingWithoutRecipients(TestCaseWithFactory):

=== 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-04 20:04:35 +0000
@@ -75,23 +75,48 @@
 
 
 class ProductEditViewPermissionTestCase(EditViewPermissionBase):
-    """Tests for permissions to access prodcut +edit page."""
+    """Tests for permissions to access product +edit page."""
     def setupTarget(self):
         self.target = self.factory.makeProduct()
 
 
 class ProjectEditViewPermissionTestCase(EditViewPermissionBase):
-    """Tests for permissions to access prodcut +edit page."""
+    """Tests for permissions to access product +edit page."""
     def setupTarget(self):
         self.target = self.factory.makeProject()
 
 
 class DistributionEditViewPermissionTestCase(EditViewPermissionBase):
-    """Tests for permissions to access prodcut +edit page."""
+    """Tests for permissions to access product +edit page."""
     def setupTarget(self):
         self.target = self.factory.makeDistribution()
 
 
+class DistroSourcePackageEditViewPermissionTestCase(EditViewPermissionBase):
+    """Test for permissions to access a distribution source package
+       +edit page."""
+
+    def setupTarget(self):
+        self.d_owner = self.factory.makePerson()
+        login_person(self.d_owner)
+        self.distro = self.factory.makeDistribution(name='youbuntu',
+                                                    owner=self.d_owner)
+        self.target = self.factory.makeDistributionSourcePackage(
+            distribution=self.distro)
+        self.supervisor_team = self.factory.makeTeam(
+            owner=self.d_owner)
+        self.supervisor_member = self.factory.makePerson()
+        self.supervisor_team.addMember(
+            self.supervisor_member, self.d_owner)
+        self.distro.setBugSupervisor(
+            self.supervisor_team, self.d_owner)
+
+    def test_bug_supervisor_can_edit(self):
+        login_person(self.supervisor_member)
+        view = create_initialized_view(self.target, '+edit')
+        self.assertTrue(check_permission('launchpad.Edit', view))
+
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.TestLoader().loadTestsFromName(__name__))