← Back to team overview

launchpad-reviewers team mailing list archive

lp:~brian-murray/launchpad/modify-official-bug-tags-permissions into lp:launchpad/devel

 

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

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


This branch creates a new permission launchpad.BugSupervisor and grants a project's bug supervisor the ability to set official bug tags for that project.  The launchpad.BugSupervisor position will also be used in other places for example setting the bug reporting guidelines and bug reported acknowledgment.

The launchpad.BugSupervisor permission was discussed with Curtis, in #launchpad-dev, who thought it was a good idea.

I've added a test to xx-official-bug-tags.txt to ensure that the +manage-official-tags link appears for a bug supervisor.

bin/test -cvvt xx-official-bug-tags.txt
-- 
https://code.launchpad.net/~brian-murray/launchpad/modify-official-bug-tags-permissions/+merge/37758
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~brian-murray/launchpad/modify-official-bug-tags-permissions into lp:launchpad/devel.
=== modified file 'lib/canonical/launchpad/mailnotification.py'
--- lib/canonical/launchpad/mailnotification.py	2010-10-03 15:30:06 +0000
+++ lib/canonical/launchpad/mailnotification.py	2010-10-06 16:31:26 +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/permissions.zcml'
--- lib/canonical/launchpad/permissions.zcml	2010-08-13 21:30:24 +0000
+++ lib/canonical/launchpad/permissions.zcml	2010-10-06 16:31:26 +0000
@@ -67,6 +67,11 @@
     access_level="write" />
 
   <permission
+    id="launchpad.BugSupervisor"
+    title="The role of managing bugs and bug rules for a product."
+    access_level="write" />
+
+  <permission
     id="launchpad.Owner"
     title="The role of someone who created or otherwise owns an object."
     access_level="write" />

=== 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-06 16:31:26 +0000
@@ -61,6 +61,7 @@
     IBuildFarmJobOld,
     )
 from lp.buildmaster.interfaces.packagebuild import IPackageBuild
+from lp.bugs.interfaces.bugtarget import IOfficialBugTagTargetRestricted
 from lp.code.interfaces.branch import (
     IBranch,
     user_has_special_branch_access,
@@ -656,7 +657,7 @@
 
     def checkAuthenticated(self, user):
         """Only the Launchpad admins need this, we are only going to use it
-        for connecting up series and distroseriess where we did not have
+        for connecting up series and distroseries where we did not have
         them."""
         return user.in_admin
 
@@ -897,6 +898,18 @@
                 user.in_admin)
 
 
+class EditProductOfficialBugTagsByOwnerBugSupervisorOrAdmins(AuthorizationBase):
+    """The owner of a product and its bug supervisor should be able to
+    edit its official bug tags."""
+    permission = 'launchpad.BugSupervisor'
+    usedfor = IOfficialBugTagTargetRestricted
+
+    def checkAuthenticated(self, user):
+        return (user.inTeam(self.obj.bug_supervisor) or
+                user.inTeam(self.obj.owner) or
+                user.in_admin)
+
+
 class AdminDistroSeries(AdminByAdminsTeam):
     """Soyuz involves huge chunks of data in the archive and librarian,
     so for the moment we are locking down admin and edit on distributions
@@ -1929,7 +1942,7 @@
     def checkAuthenticated(self, user):
         """Can the user view the submission details?
 
-        Submissions that not marked private are publicly visible,
+        Submissions that are not marked private are publicly visible,
         private submissions may only be accessed by their owner and by
         admins.
         """

=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py	2010-10-04 06:20:04 +0000
+++ lib/lp/bugs/browser/bugtarget.py	2010-10-06 16:31:26 +0000
@@ -1384,7 +1384,7 @@
     def show_manage_tags_link(self):
         """Should a link to a "manage official tags" page be shown?"""
         return (IOfficialBugTagTargetRestricted.providedBy(self.context) and
-                check_permission('launchpad.Edit', self.context))
+                check_permission('launchpad.BugSupervisor', self.context))
 
 
 class OfficialBugTagsManageView(LaunchpadEditFormView):

=== modified file 'lib/lp/bugs/browser/configure.zcml'
--- lib/lp/bugs/browser/configure.zcml	2010-10-03 15:30:06 +0000
+++ lib/lp/bugs/browser/configure.zcml	2010-10-06 16:31:26 +0000
@@ -112,7 +112,7 @@
             for="lp.bugs.interfaces.bugtarget.IOfficialBugTagTargetRestricted"
             class="lp.bugs.browser.bugtarget.OfficialBugTagsManageView"
             facet="bugs"
-            permission="launchpad.Edit"
+            permission="launchpad.BugSupervisor"
             template="../templates/official-bug-target-manage-tags.pt"/>
         <browser:page
             name="+patches"

=== 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-06 16:31:26 +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/stories/bug-tags/xx-official-bug-tags.txt'
--- lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt	2010-10-03 15:30:06 +0000
+++ lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt	2010-10-06 16:31:26 +0000
@@ -52,13 +52,32 @@
     ...
     Unauthorized...
 
+The link is also available for the bug supervisor.
+
+    >>> from lp.testing.sampledata import ADMIN_EMAIL
+    >>> from canonical.launchpad.ftests import login, logout
+    >>> login(ADMIN_EMAIL)
+    >>> d_owner = factory.makePerson()
+    >>> logout()
+    >>> login_person(d_owner)
+    >>> distro = factory.makeDistribution(name='youbuntu', owner=d_owner)
+    >>> supervisor_team = factory.makeTeam(owner=d_owner)
+    >>> supervisor_member = factory.makePerson(password='g00dpassword')
+    >>> added = supervisor_team.addMember(supervisor_member, d_owner)
+    >>> distro.setBugSupervisor(supervisor_team, d_owner)
+    >>> bug_super_browser = setupBrowser(
+    ...     auth='Basic %s:g00dpassword' %
+    ...         supervisor_member.preferredemail.email)
+    >>> logout()
+    >>> bug_super_browser.open(
+    ...     'http://bugs.launchpad.dev/youbuntu/+manage-official-tags')
+
 
 == Official Tags on Bug Pages ==
 
 Official tags are displayed using a different style from unofficial ones.
 They are grouped together at the beginning of the list.
 
-    >>> from canonical.launchpad.ftests import login, logout
     >>> from canonical.launchpad.webapp import canonical_url
     >>> from lp.bugs.tests.bug import print_bug_tag_anchors
     >>> import transaction

=== modified file 'lib/lp/bugs/tests/test_bugnotification.py'
--- lib/lp/bugs/tests/test_bugnotification.py	2010-10-04 19:50:45 +0000
+++ lib/lp/bugs/tests/test_bugnotification.py	2010-10-06 16:31:26 +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/configure.zcml'
--- lib/lp/registry/configure.zcml	2010-10-04 20:46:55 +0000
+++ lib/lp/registry/configure.zcml	2010-10-06 16:31:26 +0000
@@ -454,12 +454,14 @@
                 upstream_product
                 target_type_display
                 _getOfficialTagClause
-                official_bug_tags
                 findRelatedArchives
                 findRelatedArchivePublications
                 userHasBugSubscriptions
                 userCanAlterBugSubscription"/>
         <require
+            permission="launchpad.BugSupervisor"
+            attributes="official_bug_tags"/>
+        <require
             permission="launchpad.AnyPerson"
             attributes="
                 addSubscription
@@ -1143,13 +1145,15 @@
                             freshmeatproject homepage_content
                             homepageurl icon license_info licenses
                             logo mugshot official_answers
-                            official_blueprints official_bug_tags
-                            official_codehosting official_malone owner
-                            programminglang project
-                            redeemSubscriptionVoucher releaseroot
-                            remote_product screenshotsurl
-                            security_contact sourceforgeproject
-                            summary title wikiurl"/>
+                            official_blueprints official_codehosting
+                            official_malone owner programminglang
+                            project redeemSubscriptionVoucher
+                            releaseroot remote_product screenshotsurl
+                            security_contact sourceforgeproject summary
+                            title wikiurl"/>
+        <require
+            permission="launchpad.BugSupervisor"
+            set_attributes="official_bug_tags"/>
 
         <!-- mark 2006-04-10 I put "name" in the admin group because
                         with Bazaar now in place, lots of people can have personal
@@ -1464,7 +1468,10 @@
                 icon logo mugshot enable_bug_expiration
                 bug_reporting_guidelines bug_reported_acknowledgement
                 official_blueprints official_malone
-                official_rosetta official_answers official_bug_tags"/>
+                official_rosetta official_answers"/>
+        <require
+            permission="launchpad.BugSupervisor"
+            set_attributes="official_bug_tags"/>
         <require
             permission="launchpad.TranslationsAdmin"
             set_attributes="