Merge lp:~brian-murray/launchpad/modify-official-bug-tags-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: 11701
Proposed branch: lp:~brian-murray/launchpad/modify-official-bug-tags-permissions
Merge into: lp:launchpad
Diff against target: 354 lines (+163/-65)
7 files modified
lib/canonical/launchpad/permissions.zcml (+5/-0)
lib/canonical/launchpad/security.py (+19/-4)
lib/lp/bugs/browser/bugtarget.py (+1/-1)
lib/lp/bugs/browser/configure.zcml (+1/-1)
lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt (+18/-1)
lib/lp/bugs/stories/webservice/xx-bug-target.txt (+23/-0)
lib/lp/registry/configure.zcml (+96/-58)
To merge this branch: bzr merge lp:~brian-murray/launchpad/modify-official-bug-tags-permissions
Reviewer Review Type Date Requested Status
Edwin Grubbs (community) code Approve
Review via email: mp+37758@code.launchpad.net

Commit message

Allow a project's or distribution's bug supervisor to set the official bug tags for it.

Description of the change

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

To post a comment you must log in.
Revision history for this message
Edwin Grubbs (edwin-grubbs) wrote :
Download full text (5.3 KiB)

Hi Brian,

This branch looks good. I have a few comments below for changes I would like.

-Edwin

>=== 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 17:27:19 +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."""

According to PEP8, if the docstring is more than one line, the
ending triple-quotes should appear on a line by itself.

> return user.in_admin
>
>@@ -897,6 +898,18 @@
> user.in_admin)
>
>
>+class EditProductOfficialBugTagsByOwnerBugSupervisorOrAdmins(AuthorizationBase):

This line is too long. It can be wrapped like
AdminDistroSeriesLanguagePacks.

>+ """The owner of a product and its bug supervisor should be able to
>+ edit its official bug tags."""

The first sentence of the docstring should fit on a single line, and
there should be a blank line separating it from any additional text.

>+ 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
>=== 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 17:27:19 +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/+...

Read more...

review: Approve (code)
Revision history for this message
Robert Collins (lifeless) wrote :

Wouldn't it be usual to check for Launchpad.Edit on context.official_tags ?

This branch adds a special case that isn't needed; better to change
how Edit is obtained for the tags object.

Or perhaps I misunderstand how things are structured.

-Rob

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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-14 17:02:44 +0000
@@ -67,6 +67,11 @@
67 access_level="write" />67 access_level="write" />
6868
69 <permission69 <permission
70 id="launchpad.BugSupervisor"
71 title="The role of managing bugs and bug rules for a product."
72 access_level="write" />
73
74 <permission
70 id="launchpad.Owner"75 id="launchpad.Owner"
71 title="The role of someone who created or otherwise owns an object."76 title="The role of someone who created or otherwise owns an object."
72 access_level="write" />77 access_level="write" />
7378
=== modified file 'lib/canonical/launchpad/security.py'
--- lib/canonical/launchpad/security.py 2010-10-04 19:55:15 +0000
+++ lib/canonical/launchpad/security.py 2010-10-14 17:02:44 +0000
@@ -61,6 +61,7 @@
61 IBuildFarmJobOld,61 IBuildFarmJobOld,
62 )62 )
63from lp.buildmaster.interfaces.packagebuild import IPackageBuild63from lp.buildmaster.interfaces.packagebuild import IPackageBuild
64from lp.bugs.interfaces.bugtarget import IOfficialBugTagTargetRestricted
64from lp.code.interfaces.branch import (65from lp.code.interfaces.branch import (
65 IBranch,66 IBranch,
66 user_has_special_branch_access,67 user_has_special_branch_access,
@@ -655,9 +656,10 @@
655 usedfor = IMilestone656 usedfor = IMilestone
656657
657 def checkAuthenticated(self, user):658 def checkAuthenticated(self, user):
658 """Only the Launchpad admins need this, we are only going to use it659 """Only the Launchpad admins need this, we are only going to use
659 for connecting up series and distroseriess where we did not have660 it for connecting up series and distroseries where we did not
660 them."""661 have them.
662 """
661 return user.in_admin663 return user.in_admin
662664
663665
@@ -898,6 +900,19 @@
898 user.in_admin)900 user.in_admin)
899901
900902
903class EditProductOfficialBugTagsByOwnerOrBugSupervisorOrAdmins(
904 AuthorizationBase):
905 """Product's owner and bug supervisor can set official bug tags."""
906
907 permission = 'launchpad.BugSupervisor'
908 usedfor = IOfficialBugTagTargetRestricted
909
910 def checkAuthenticated(self, user):
911 return (user.inTeam(self.obj.bug_supervisor) or
912 user.inTeam(self.obj.owner) or
913 user.in_admin)
914
915
901class AdminDistroSeries(AdminByAdminsTeam):916class AdminDistroSeries(AdminByAdminsTeam):
902 """Soyuz involves huge chunks of data in the archive and librarian,917 """Soyuz involves huge chunks of data in the archive and librarian,
903 so for the moment we are locking down admin and edit on distributions918 so for the moment we are locking down admin and edit on distributions
@@ -1930,7 +1945,7 @@
1930 def checkAuthenticated(self, user):1945 def checkAuthenticated(self, user):
1931 """Can the user view the submission details?1946 """Can the user view the submission details?
19321947
1933 Submissions that not marked private are publicly visible,1948 Submissions that are not marked private are publicly visible,
1934 private submissions may only be accessed by their owner and by1949 private submissions may only be accessed by their owner and by
1935 admins.1950 admins.
1936 """1951 """
19371952
=== 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-14 17:02:44 +0000
@@ -1384,7 +1384,7 @@
1384 def show_manage_tags_link(self):1384 def show_manage_tags_link(self):
1385 """Should a link to a "manage official tags" page be shown?"""1385 """Should a link to a "manage official tags" page be shown?"""
1386 return (IOfficialBugTagTargetRestricted.providedBy(self.context) and1386 return (IOfficialBugTagTargetRestricted.providedBy(self.context) and
1387 check_permission('launchpad.Edit', self.context))1387 check_permission('launchpad.BugSupervisor', self.context))
13881388
13891389
1390class OfficialBugTagsManageView(LaunchpadEditFormView):1390class OfficialBugTagsManageView(LaunchpadEditFormView):
13911391
=== 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-14 17:02:44 +0000
@@ -112,7 +112,7 @@
112 for="lp.bugs.interfaces.bugtarget.IOfficialBugTagTargetRestricted"112 for="lp.bugs.interfaces.bugtarget.IOfficialBugTagTargetRestricted"
113 class="lp.bugs.browser.bugtarget.OfficialBugTagsManageView"113 class="lp.bugs.browser.bugtarget.OfficialBugTagsManageView"
114 facet="bugs"114 facet="bugs"
115 permission="launchpad.Edit"115 permission="launchpad.BugSupervisor"
116 template="../templates/official-bug-target-manage-tags.pt"/>116 template="../templates/official-bug-target-manage-tags.pt"/>
117 <browser:page117 <browser:page
118 name="+patches"118 name="+patches"
119119
=== 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-14 17:02:44 +0000
@@ -52,13 +52,30 @@
52 ...52 ...
53 Unauthorized...53 Unauthorized...
5454
55The link is also available for the bug supervisor.
56
57 >>> from lp.testing.sampledata import ADMIN_EMAIL
58 >>> from canonical.launchpad.ftests import login, logout
59 >>> login(ADMIN_EMAIL)
60 >>> supervisor = factory.makePerson(password='g00dpassword')
61 >>> youbuntu = factory.makeProduct(name='youbuntu',
62 ... bug_supervisor=supervisor,
63 ... official_malone=True)
64 >>> bug_super_browser = setupBrowser(
65 ... auth='Basic %s:g00dpassword' %
66 ... supervisor.preferredemail.email)
67 >>> logout()
68 >>> bug_super_browser.open(
69 ... 'http://bugs.launchpad.dev/youbuntu')
70 >>> bug_super_browser.getLink('Edit official tags').click()
71 >>> print bug_super_browser.url
72 http://bugs.launchpad.dev/youbuntu/+manage-official-tags
5573
56== Official Tags on Bug Pages ==74== Official Tags on Bug Pages ==
5775
58Official tags are displayed using a different style from unofficial ones.76Official tags are displayed using a different style from unofficial ones.
59They are grouped together at the beginning of the list.77They are grouped together at the beginning of the list.
6078
61 >>> from canonical.launchpad.ftests import login, logout
62 >>> from canonical.launchpad.webapp import canonical_url79 >>> from canonical.launchpad.webapp import canonical_url
63 >>> from lp.bugs.tests.bug import print_bug_tag_anchors80 >>> from lp.bugs.tests.bug import print_bug_tag_anchors
64 >>> import transaction81 >>> import transaction
6582
=== modified file 'lib/lp/bugs/stories/webservice/xx-bug-target.txt'
--- lib/lp/bugs/stories/webservice/xx-bug-target.txt 2010-10-03 15:30:06 +0000
+++ lib/lp/bugs/stories/webservice/xx-bug-target.txt 2010-10-14 17:02:44 +0000
@@ -87,6 +87,29 @@
87 ...87 ...
88 <BLANKLINE>88 <BLANKLINE>
8989
90The bug supervisor of a product can also add tags.
91
92 >>> login('foo.bar@canonical.com')
93 >>> salgado = getUtility(IPersonSet).getByName('salgado')
94 >>> product = factory.makeProduct(name='tags-test-product2')
95 >>> logout()
96 >>> ws_salgado = webservice.get('/~salgado').jsonBody()
97 >>> print webservice.patch(
98 ... '/tags-test-product2', 'application/json',
99 ... dumps({'bug_supervisor_link': ws_salgado['self_link']}))
100 HTTP/1.1 209 Content Returned...
101
102The webservice client is logged in as salgado and he can add a new official
103tag.
104
105 >>> print webservice.named_post(
106 ... '/tags-test-product2', 'addOfficialBugTag',
107 ... tag='test-bug-tag2')
108 HTTP/1.1 200 Ok
109 ...
110 <BLANKLINE>
111 null
112
90Official tags must conform to the same format as ordinary tags.113Official tags must conform to the same format as ordinary tags.
91114
92 >>> print webservice.named_post(115 >>> print webservice.named_post(
93116
=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml 2010-10-07 21:07:40 +0000
+++ lib/lp/registry/configure.zcml 2010-10-14 17:02:44 +0000
@@ -409,52 +409,52 @@
409409
410 <allow410 <allow
411 attributes="411 attributes="
412 distribution412 __eq__
413 development_version
414 sourcepackagename
415 name
416 displayname
417 title
418 summary
419 distro
420 get_distroseries_packages
421 subscribers
422 currentrelease
423 releases
424 publishing_history
425 current_publishing_records
426 bug_reporting_guidelines
427 bug_reported_acknowledgement
428 latest_overall_publication
429 __getitem__413 __getitem__
430 getVersion
431 __eq__
432 __ne__414 __ne__
415 _getOfficialTagClause
416 all_bugtasks
417 bug_count
418 bug_reported_acknowledgement
419 bug_reporting_guidelines
420 bugtargetdisplayname
421 bugtargetname
433 bugtasks422 bugtasks
434 searchTasks
435 open_bugtasks
436 closed_bugtasks423 closed_bugtasks
437 critical_bugtasks424 critical_bugtasks
425 current_publishing_records
426 currentrelease
427 development_version
428 displayname
429 distribution
430 distro
431 findRelatedArchivePublications
432 findRelatedArchives
433 getBugCounts
434 getPersonsByEmail
435 getReleasesAndPublishingHistory
436 getUsedBugTags
437 getUsedBugTagsWithOpenCounts
438 getVersion
439 get_distroseries_packages
440 has_bugtasks
438 high_bugtasks441 high_bugtasks
439 inprogress_bugtasks442 inprogress_bugtasks
440 unassigned_bugtasks443 latest_overall_publication
444 name
441 new_bugtasks445 new_bugtasks
442 all_bugtasks446 official_bug_tags
443 has_bugtasks447 open_bugtasks
444 getUsedBugTags448 publishing_history
445 getUsedBugTagsWithOpenCounts449 releases
446 bugtargetdisplayname450 searchTasks
447 bugtargetname451 sourcepackagename
448 getBugCounts452 subscribers
449 bug_count453 summary
454 title
450 total_bug_heat455 total_bug_heat
451 getPersonsByEmail456 unassigned_bugtasks
452 getReleasesAndPublishingHistory457 upstream_product"/>
453 upstream_product
454 _getOfficialTagClause
455 official_bug_tags
456 findRelatedArchives
457 findRelatedArchivePublications"/>
458 <require458 <require
459 permission="launchpad.AnyPerson"459 permission="launchpad.AnyPerson"
460 attributes="createBug"/>460 attributes="createBug"/>
@@ -1130,21 +1130,44 @@
1130 set_schema="lp.app.interfaces.launchpad.IServiceUsage"/>1130 set_schema="lp.app.interfaces.launchpad.IServiceUsage"/>
1131 <require1131 <require
1132 permission="launchpad.Edit"1132 permission="launchpad.Edit"
1133 set_attributes="bug_reporting_guidelines1133 set_attributes="
1134 bug_reported_acknowledgement bugtracker1134 bug_reported_acknowledgement
1135 commercial_subscription description1135 bug_reporting_guidelines
1136 development_focus displayname downloadurl1136 bugtracker
1137 driver enable_bug_expiration1137 commercial_subscription
1138 freshmeatproject homepage_content1138 description
1139 homepageurl icon license_info licenses1139 development_focus
1140 logo mugshot official_answers1140 displayname
1141 official_blueprints official_bug_tags1141 downloadurl
1142 official_codehosting official_malone owner1142 driver
1143 programminglang project1143 enable_bug_expiration
1144 redeemSubscriptionVoucher releaseroot1144 freshmeatproject
1145 remote_product screenshotsurl1145 homepage_content
1146 security_contact sourceforgeproject1146 homepageurl
1147 summary title wikiurl"/>1147 icon
1148 license_info
1149 licenses
1150 logo
1151 mugshot
1152 official_answers
1153 official_blueprints
1154 official_codehosting
1155 official_malone
1156 owner
1157 programminglang
1158 project
1159 redeemSubscriptionVoucher
1160 releaseroot
1161 remote_product
1162 screenshotsurl
1163 security_contact
1164 sourceforgeproject
1165 summary
1166 title
1167 wikiurl"/>
1168 <require
1169 permission="launchpad.BugSupervisor"
1170 set_attributes="official_bug_tags"/>
11481171
1149 <!-- mark 2006-04-10 I put "name" in the admin group because1172 <!-- mark 2006-04-10 I put "name" in the admin group because
1150 with Bazaar now in place, lots of people can have personal1173 with Bazaar now in place, lots of people can have personal
@@ -1438,12 +1461,27 @@
1438 <require1461 <require
1439 permission="launchpad.Edit"1462 permission="launchpad.Edit"
1440 set_attributes="1463 set_attributes="
1441 displayname title summary description driver1464 bug_reported_acknowledgement
1442 members owner security_contact mirror_admin homepage_content1465 bug_reporting_guidelines
1443 icon logo mugshot enable_bug_expiration1466 description
1444 bug_reporting_guidelines bug_reported_acknowledgement1467 displayname
1445 official_blueprints official_malone1468 driver
1446 official_rosetta official_answers official_bug_tags"/>1469 enable_bug_expiration
1470 homepage_content
1471 icon
1472 logo
1473 members
1474 mirror_admin
1475 mugshot
1476 official_answers
1477 official_blueprints
1478 official_bug_tags
1479 official_malone
1480 official_rosetta
1481 owner
1482 security_contact
1483 summary
1484 title"/>
1447 <require1485 <require
1448 permission="launchpad.TranslationsAdmin"1486 permission="launchpad.TranslationsAdmin"
1449 set_attributes="1487 set_attributes="