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

Proposed by William Grant
Status: Merged
Approved by: Graham Binns
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 Approve
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.
Revision history for this message
Graham Binns (gmb) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/canonical/launchpad/security.py'
--- lib/canonical/launchpad/security.py 2010-08-26 13:10:24 +0000
+++ lib/canonical/launchpad/security.py 2010-08-31 09:27:45 +0000
@@ -2526,6 +2526,11 @@
2526 return user.in_ubuntu_branches or user.in_admin2526 return user.in_ubuntu_branches or user.in_admin
25272527
25282528
2529class ViewPackageset(AnonymousAuthorization):
2530 """Anyone can view an IPackageset."""
2531 usedfor = IPackageset
2532
2533
2529class EditPackageset(AuthorizationBase):2534class EditPackageset(AuthorizationBase):
2530 permission = 'launchpad.Edit'2535 permission = 'launchpad.Edit'
2531 usedfor = IPackageset2536 usedfor = IPackageset
25322537
=== modified file 'lib/lp/soyuz/stories/webservice/xx-packageset.txt'
--- lib/lp/soyuz/stories/webservice/xx-packageset.txt 2010-08-05 20:49:08 +0000
+++ lib/lp/soyuz/stories/webservice/xx-packageset.txt 2010-08-31 09:27:45 +0000
@@ -185,7 +185,7 @@
185 ... for entry in body['entries']:185 ... for entry in body['entries']:
186 ... print entry['self_link']186 ... print entry['self_link']
187187
188 >>> response = webservice.get("/package-sets/")188 >>> response = anon_webservice.get("/package-sets/")
189 >>> print_payload(response)189 >>> print_payload(response)
190 http://api.launchpad.dev/beta/package-sets/hoary/umbrella190 http://api.launchpad.dev/beta/package-sets/hoary/umbrella
191191