Merge lp:~jamalta/launchpad/515761-anonymrelease into lp:launchpad/db-devel
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Brad Crittenden on 2010-02-08 | ||||
| Approved revision: | not available | ||||
| Merged at revision: | not available | ||||
| Proposed branch: | lp:~jamalta/launchpad/515761-anonymrelease | ||||
| Merge into: | lp:launchpad/db-devel | ||||
| Diff against target: |
270 lines (+84/-30) (has conflicts) 7 files modified
lib/canonical/launchpad/security.py (+36/-17) lib/lp/bugs/interfaces/bugtask.py (+2/-4) lib/lp/bugs/stories/webservice/xx-bug.txt (+12/-7) lib/lp/registry/browser/configure.zcml (+1/-1) lib/lp/registry/browser/productseries.py (+1/-1) lib/lp/registry/stories/webservice/xx-project-registry.txt (+14/-0) lib/lp/testing/factory.py (+18/-0) Text conflict in lib/canonical/launchpad/security.py Text conflict in lib/lp/testing/factory.py |
||||
| To merge this branch: | bzr merge lp:~jamalta/launchpad/515761-anonymrelease | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Paul Hummer (community) | code | 2010-02-04 | Approve on 2010-02-05 |
|
Review via email:
|
|||
Commit Message
Created View classes for IMessage, IProductRelease, and IBugSubscription to allow anonymous API access to these interfaces. Fixed misspelling of 'permission' attribute for ViewProductSeries. Fixed security problem in test xx-product-
| Jamal Fanaian (jamalta) wrote : | # |
| Jamal Fanaian (jamalta) wrote : | # |
= Summary =
Anonymous API Access to some collections returns nothing.
== Proposed fix ==
Create View classes in security.py for the interfaces that need anonymous access.
== Pre-implementation notes ==
Decision to make these collections available to everyone needs to be considered during review.
== Implementation details ==
Created ViewBugMessage, ViewProductRelease, and ViewBugSubscription in security.py with checkUnauthorized and checkAuthorized both returning True. Also had to modify permissions for ubuntupkg which bac caught.
== Tests ==
% bin/test -vvct webservice/
% bin/test -vvct xx-project-registry
% bin/test -vvct xx-product-
== Demo and Q/A ==
>>> from launchpadlib.
>>> launchpad = Launchpad.
>>> list(launchpad.
[<project_series at https:/
>>> list(launchpad.
[<message at https:/
>>> list(launchpad.
[<bug_subscription at https:/
== Launchpad lint ==
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files:
lib/canonical
lib/canonical
lib/lp/
lib/lp/
| Paul Hummer (rockstar) wrote : | # |
<rockstar> jamalta, hm, maybe you should have a single class that inherits from AuthorizationBase that deals with checkAuthenticated and checkUnauthenti
<jamalta> rockstar: i was thinking of doing that but no other class does that
<rockstar> jamalta, well, that may be for hysterical reasons. I don't see why new code should be like that.
<jamalta> and then there's the message on launchpad-dev from henning talking about refactoring security.py altogether
<jamalta> rockstar: i could do that if you would prefer though
<rockstar> jamalta, I say do it. Talk on a mailing list gets trumped by actual code.
<jamalta> rockstar: haha, sounds good :)
<jamalta> ViewByAnyUser a good name?
<rockstar> jamalta, AnonymousAuthor
<jamalta> rockstar: even better
| Jamal Fanaian (jamalta) wrote : | # |
=== modified file 'lib/canonical/
--- lib/canonical/
+++ lib/canonical/
@@ -172,6 +172,19 @@
return True
+class AnonymousAuthor
+ """Allow any authenticated and unauthenticated user access."""
+ permission = 'launchpad.View'
+
+ def checkUnauthenti
+ """Any unauthorized user can see this object."""
+ return True
+
+ def checkAuthentica
+ """Any authorized user can see this object."""
+ return True
+
+
class AdminByAdminsTe
permission = 'launchpad.Admin'
usedfor = Interface
@@ -815,24 +828,9 @@
-class ViewProductSeri
+class ViewProductSeri
usedfor = IProductSeries
- permission = 'launchpad.View'
-
- def checkUnauthenti
- """See `IAuthorization
-
- :return: True or False.
- """
- return True
-
- def checkAuthentica
- """See `IAuthorization
-
- :return: True or False.
- """
- return True
class EditProductSeri
@@ -980,44 +978,14 @@
self, bugattachment.bug)
-class ViewBugSubscrip
+class ViewBugSubscrip
usedfor = IBugSubscription
- permission = 'launchpad.View'
-
- def checkUnauthenti
- """See `IAuthorization
-
- :return: True or False.
- """
- return True
-
- def checkAuthentica
- """See `IAuthorization
-
- :return: True or False.
- """
- return True
-
-
-class ViewBugMessage(
+
+
+class ViewBugMessage(
usedfor = IMessage
- permission = 'launchpad.View'
-
- def checkUnauthenti
- """See `IAuthorization
-
- :return: True or False.
- """
- return True
-
- def checkAuthentica
- """See `IAuthorization
-
- :return: True or False.
- """
- return True
class ViewAnnouncemen
@@ -1323,24 +1291,9 @@
self, user)
-class ViewProductRele
+class ViewProductRele
usedfor = IProductRelease
- permission = 'launchpad.View'
-
- def checkUnauthenti
- """See `IAuthorization
-
- :return: True or False.
- """
- return True
-
- def checkAuthentica
- """See `IAuthorization
-
- :return: True or False.
- """
- return True
class AdminTranslatio
| Jamal Fanaian (jamalta) wrote : | # |
Paul,
That was the diff for the last changes you requested. Based on salgado's recommendation I posted a message to launchpad-dev to confirm any security concerns with these changes.
Thanks again for reviewing this.

= Summary =
Anonymous API Access to some collections returns nothing.
== Proposed fix ==
Create View classes in security.py for the interfaces that need anonymous access.
== Pre-implementation notes ==
Decision to make these collections available to everyone needs to be considered during review.
== Implementation details ==
Created ViewBugMessage, ViewProductRelease, and ViewBugSubscription in security.py with checkUnauthorized and checkAuthorized both returning True.
== Tests ==
% bin/test -vvct webservice/ xx-bug. txt
% bin/test -vvct xx-project-registry
== Demo and Q/A ==
>>> from launchpadlib. launchpad import Launchpad login(' test', '', '', 'https:/ /api.launchpad. dev/beta/ ') projects[ 'alsa-utils' ].series) /api.launchpad. dev/beta/ alsa-utils/ trunk>] bugs[1] .messages) /api.launchpad. dev/beta/ firefox/ +bug/1/ comments/ 0>, <message at https:/ /api.launchpad. dev/beta/ firefox/ +bug/1/ comments/ 1>] bugs[1] .subscriptions) /api.launchpad. dev/beta/ bugs/1/ +subscription/ stevea>, <bug_subscription at https:/ /api.launchpad. dev/beta/ bugs/1/ +subscription/ name12>]
>>> launchpad = Launchpad.
>>> list(launchpad.
[<project_series at https:/
>>> list(launchpad.
[<message at https:/
>>> list(launchpad.
[<bug_subscription at https:/
== Launchpad lint ==
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files: /launchpad/ security. py /launchpad/ apidoc/ wadl-testrunner .xml bugs/stories/ webservice/ xx-bug. txt registry/ stories/ webservice/ xx-project- registry. txt
lib/canonical
lib/canonical
lib/lp/
lib/lp/