Merge lp:~thumper/launchpad/more-product-series-permissions into lp:launchpad

Proposed by Tim Penhey on 2010-01-06
Status: Merged
Merged at revision: not available
Proposed branch: lp:~thumper/launchpad/more-product-series-permissions
Merge into: lp:launchpad
Diff against target: 74 lines (+24/-8)
2 files modified
lib/canonical/launchpad/security.py (+8/-5)
lib/lp/registry/browser/tests/productseries-views.txt (+16/-3)
To merge this branch: bzr merge lp:~thumper/launchpad/more-product-series-permissions
Reviewer Review Type Date Requested Status
Paul Hummer (community) 2010-01-06 Approve on 2010-01-06
Review via email: mp+16888@code.launchpad.net

Commit Message

Expand launchpad.Edit on product series to include registry experts and bazaar experts.

To post a comment you must log in.
Tim Penhey (thumper) wrote :

As per discussion with Curtis earlier today, added registry experts and bazaar experts to the launchpad.Edit security checker for IProductSeries.

tests: lp/registry/browser/tests/productseries-views.txt

Paul Hummer (rockstar) :
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-01-05 14:17:02 +0000
3+++ lib/canonical/launchpad/security.py 2010-01-06 02:34:17 +0000
4@@ -857,17 +857,20 @@
5 usedfor = IProductSeries
6
7 def checkAuthenticated(self, user):
8- """Allow product owner, Rosetta Experts, or admins."""
9+ """Allow product owner, some experts, or admins."""
10 if (user.inTeam(self.obj.product.owner) or
11 user.inTeam(self.obj.driver)):
12 # The user is the owner of the product, or the release manager.
13 return True
14 # Rosetta experts need to be able to upload translations.
15- rosetta_experts = getUtility(ILaunchpadCelebrities).rosetta_experts
16- if user.inTeam(rosetta_experts):
17+ # Bazaar experts need to be able to change the linked branches.
18+ # Registry admins are just special.
19+ celebrities = getUtility(ILaunchpadCelebrities)
20+ if (user.inTeam(celebrities.registry_experts) or
21+ user.inTeam(celebrities.bazaar_experts) or
22+ user.inTeam(celebrities.rosetta_experts)):
23 return True
24- return EditByOwnersOrAdmins.checkAuthenticated(
25- self, user)
26+ return EditByOwnersOrAdmins.checkAuthenticated(self, user)
27
28
29 class EditBugTask(AuthorizationBase):
30
31=== modified file 'lib/lp/registry/browser/tests/productseries-views.txt'
32--- lib/lp/registry/browser/tests/productseries-views.txt 2009-12-05 02:53:07 +0000
33+++ lib/lp/registry/browser/tests/productseries-views.txt 2010-01-06 02:34:17 +0000
34@@ -184,6 +184,15 @@
35 >>> print view.cancel_url
36 http://launchpad.dev/app/simple
37
38+Bazaar experts can change the branch links.
39+
40+ >>> from canonical.launchpad.interfaces.launchpad import (
41+ ... ILaunchpadCelebrities)
42+ >>> celebrities = getUtility(ILaunchpadCelebrities)
43+ >>> login_person(celebrities.bazaar_experts.teamowner)
44+ >>> check_permission('launchpad.Edit', view)
45+ True
46+
47
48 Delete ProductSeries
49 --------------------
50@@ -219,6 +228,12 @@
51 >>> check_permission('launchpad.Edit', view)
52 True
53
54+Registry experts can also access the view.
55+
56+ >>> login_person(celebrities.registry_experts.teamowner)
57+ >>> check_permission('launchpad.Edit', view)
58+ True
59+
60 The delete view has a label and page_title to explain what it does.
61
62 >>> print view.label
63@@ -394,10 +409,8 @@
64 avoid conflicts. The linked branch is removed.
65
66 >>> from zope.component import getUtility
67- >>> from canonical.launchpad.interfaces.launchpad import (
68- ... ILaunchpadCelebrities)
69
70- >>> obsolete_junk = getUtility(ILaunchpadCelebrities).obsolete_junk
71+ >>> obsolete_junk = celebrities.obsolete_junk
72 >>> productseries.product == obsolete_junk
73 True
74 >>> print productseries.name