Merge lp:~wgrant/launchpad/bug-510180 into lp:launchpad

Proposed by William Grant on 2010-08-31
Status: Merged
Approved by: Graham Binns on 2010-08-31
Approved revision: no longer in the source branch.
Merged at revision: 11476
Proposed branch: lp:~wgrant/launchpad/bug-510180
Merge into: lp:launchpad
Diff against target: 27 lines (+6/-1)
2 files modified
lib/canonical/launchpad/security.py (+5/-0)
lib/lp/soyuz/stories/webservice/xx-packageset.txt (+1/-1)
To merge this branch: bzr merge lp:~wgrant/launchpad/bug-510180
Reviewer Review Type Date Requested Status
Graham Binns (community) code 2010-08-31 Approve on 2010-08-31
Review via email: mp+34175@code.launchpad.net

Commit Message

Anonymous users can now see objects in IPackageset collections

Description of the Change

lazr.restful has a nasty habit of excluding items from collections if the user doesn't hold launchpad.View on the object (even if it's accessible with zope.Public). This tiny branch grants launchpad.View on IPackageset to everybody, using the AnonymousAuthorization adapter created for this purpose. It also tweaks a test to ensure that anonymous users can now list the /package-sets collection.

To post a comment you must log in.
Graham Binns (gmb) :
review: Approve (code)

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-08-26 13:10:24 +0000
3+++ lib/canonical/launchpad/security.py 2010-08-31 09:27:45 +0000
4@@ -2526,6 +2526,11 @@
5 return user.in_ubuntu_branches or user.in_admin
6
7
8+class ViewPackageset(AnonymousAuthorization):
9+ """Anyone can view an IPackageset."""
10+ usedfor = IPackageset
11+
12+
13 class EditPackageset(AuthorizationBase):
14 permission = 'launchpad.Edit'
15 usedfor = IPackageset
16
17=== modified file 'lib/lp/soyuz/stories/webservice/xx-packageset.txt'
18--- lib/lp/soyuz/stories/webservice/xx-packageset.txt 2010-08-05 20:49:08 +0000
19+++ lib/lp/soyuz/stories/webservice/xx-packageset.txt 2010-08-31 09:27:45 +0000
20@@ -185,7 +185,7 @@
21 ... for entry in body['entries']:
22 ... print entry['self_link']
23
24- >>> response = webservice.get("/package-sets/")
25+ >>> response = anon_webservice.get("/package-sets/")
26 >>> print_payload(response)
27 http://api.launchpad.dev/beta/package-sets/hoary/umbrella
28