← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/bug-510180 into lp:launchpad/devel

 

William Grant has proposed merging lp:~wgrant/launchpad/bug-510180 into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #510180 launchpad.packagesets empty with anonymous login
  https://bugs.launchpad.net/bugs/510180


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.
-- 
https://code.launchpad.net/~wgrant/launchpad/bug-510180/+merge/34175
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/bug-510180 into lp:launchpad/devel.
=== 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 @@
         return user.in_ubuntu_branches or user.in_admin
 
 
+class ViewPackageset(AnonymousAuthorization):
+    """Anyone can view an IPackageset."""
+    usedfor = IPackageset
+
+
 class EditPackageset(AuthorizationBase):
     permission = 'launchpad.Edit'
     usedfor = IPackageset

=== 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 @@
     ...     for entry in body['entries']:
     ...         print entry['self_link']
 
-    >>> response = webservice.get("/package-sets/")
+    >>> response = anon_webservice.get("/package-sets/")
     >>> print_payload(response)
     http://api.launchpad.dev/beta/package-sets/hoary/umbrella