Merge lp:~leonardr/launchpad/publish-tokens-2 into lp:launchpad/db-devel
| Status: | Rejected |
|---|---|
| Rejected by: | Aaron Bentley on 2011-01-06 |
| Proposed branch: | lp:~leonardr/launchpad/publish-tokens-2 |
| Merge into: | lp:launchpad/db-devel |
| Diff against target: |
988 lines (+380/-120) 21 files modified
lib/canonical/launchpad/browser/oauth.py (+3/-9) lib/canonical/launchpad/database/oauth.py (+58/-6) lib/canonical/launchpad/doc/oauth.txt (+32/-8) lib/canonical/launchpad/doc/webapp-authorization.txt (+3/-11) lib/canonical/launchpad/doc/webapp-publication.txt (+7/-1) lib/canonical/launchpad/interfaces/_schema_circular_imports.py (+3/-0) lib/canonical/launchpad/interfaces/oauth.py (+80/-30) lib/canonical/launchpad/security.py (+37/-7) lib/canonical/launchpad/testing/pages.py (+15/-5) lib/canonical/launchpad/tests/test_webservice_oauth.py (+82/-0) lib/canonical/launchpad/webapp/authentication.py (+1/-6) lib/canonical/launchpad/webapp/authorization.py (+2/-1) lib/canonical/launchpad/webapp/servers.py (+7/-23) lib/canonical/launchpad/webapp/tests/test_publication.py (+6/-1) lib/canonical/launchpad/zcml/oauth.zcml (+6/-1) lib/lp/bugs/tests/test_bugs_webservice.py (+8/-0) lib/lp/registry/browser/person.py (+9/-0) lib/lp/registry/interfaces/person.py (+5/-1) lib/lp/registry/stories/webservice/xx-person.txt (+2/-0) lib/lp/testing/_webservice.py (+13/-9) versions.cfg (+1/-1) |
| To merge this branch: | bzr merge lp:~leonardr/launchpad/publish-tokens-2 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Guilherme Salgado (community) | code | Approve on 2010-09-01 | |
| Aaron Bentley (community) | 2010-08-30 | Needs Fixing on 2010-08-30 | |
|
Review via email:
|
|||
Description of the Change
This branch publishes OAuth access tokens through the web service. This meant adding traversal rules an canonical URL data for OAuthAccessToken objects.
A user can only view their own access tokens, and only by using a client that's been given the GRANT_PERMISSIONS access level. The old rules apply when accessing access tokens through the website: a user can always access their own tokens, and admins can access other peoples'.
Because I changed the rules for permission checks on OAuth access tokens to check the current request, I've added removeSecurityProxy calls in test helper classes like oauth_token_
This branch takes advantage of a new version of lazr.restful so that the read-write 'permission' field of IOAuthAccessToken can be published as read-only in the web service. This code is tested in lazr.restful, but I can add a Launchpad test as well.
- 11452. By Leonard Richardson on 2010-08-31
-
Converted oauth.txt into a unit test.
- 11453. By Leonard Richardson on 2010-08-31
-
Got the new unit tests to pass.
- 11454. By Leonard Richardson on 2010-08-31
-
Fixed indentation.
- 11455. By Leonard Richardson on 2010-08-31
-
Moved all the code requiring access to OAuthAccessToken internals into OAuthAccessToken.
| Guilherme Salgado (salgado) wrote : | # |
Leonard asked me to do a follow up review of http://
The signature of check_oauth_
Also, it'd be nice to follow the naming scheme we use for other interfaces that are divided into multiple ones based on the permissions of the attributes/methods (e.g. IFooPublic, IFooEditRestric
- 11456. By Leonard Richardson on 2010-09-01
-
Merge with trunk.
- 11457. By Leonard Richardson on 2010-09-01
-
Fixed test failures.
- 11458. By Leonard Richardson on 2010-09-01
-
Renamed the *Verification interfaces to *Public to comply with existing naming standards.
| Guilherme Salgado (salgado) wrote : | # |
And here's another follow up review: http://
+class OAuthTokenBase(
+ """Base implementation of code to check an OAuth-signed request."""
I'd change that docstring to say just that this is a base class for OAuthToken classes, as we may want to add code not related to signature checking here in the future.
+
+ def checkSignature(
+ return check_oauth_
And here you should add a docstring pointing to the interface where the method is defined.
-Now consider a principal authorized to create OAuth tokens. Whenever
-it's not creating OAuth tokens, it has a level of permission
-equivalent to READ_PUBLIC.
+A principal with the GRANT_PERMISSIONS authorization level has a of
+permission equivalent to WRITE_PRIVATE.
Why is the permission changing in this incremental diff? Also, s/of//?
- >>> access_token = token.createAcc
+ >>> access_token = removeSecurityP
Why do you need to remove the security proxy now?
- 11459. By Leonard Richardson on 2010-09-01
-
Corrected permissions.
| Leonard Richardson (leonardr) wrote : | # |
> -Now consider a principal authorized to create OAuth tokens. Whenever
> -it's not creating OAuth tokens, it has a level of permission
> -equivalent to READ_PUBLIC.
> +A principal with the GRANT_PERMISSIONS authorization level has a of
> +permission equivalent to WRITE_PRIVATE.
>
> Why is the permission changing in this incremental diff? Also, s/of//?
The permission changed last time, after we decided there was no easy way to make GRANT_PERMISSIONS have a 'write' level of access for OAuth tokens and a 'read' level for everything else. I'm just fixing the test.
> - >>> access_token = token.createAcc
> + >>> access_token = removeSecurityP
>
> Why do you need to remove the security proxy now?
Again, I'm just fixing a test failure. The security proxy started breaking this test as soon as I introduced the security checker that assumes there's a current request.
- 11460. By Leonard Richardson on 2010-09-01
-
Fixed typo and added docstring.
- 11461. By Leonard Richardson on 2010-09-02
-
I wasn't paying attention when I fixed this test failure, and I 'fixed' something that was right the first time.
- 11462. By Leonard Richardson on 2010-09-02
-
Changed the text to explain why I changed the code.
- 11463. By Leonard Richardson on 2010-09-02
-
Aand... make the change to the test that apparently I didn't make before.
- 11464. By Leonard Richardson on 2010-09-02
-
Strip security proxy in one more test.
- 11465. By Leonard Richardson on 2010-09-02
-
Added workaround for bug 619017 discovered by jcsackett.
Unmerged revisions
- 11465. By Leonard Richardson on 2010-09-02
-
Added workaround for bug 619017 discovered by jcsackett.
- 11464. By Leonard Richardson on 2010-09-02
-
Strip security proxy in one more test.
- 11463. By Leonard Richardson on 2010-09-02
-
Aand... make the change to the test that apparently I didn't make before.
- 11462. By Leonard Richardson on 2010-09-02
-
Changed the text to explain why I changed the code.
- 11461. By Leonard Richardson on 2010-09-02
-
I wasn't paying attention when I fixed this test failure, and I 'fixed' something that was right the first time.
- 11460. By Leonard Richardson on 2010-09-01
-
Fixed typo and added docstring.
- 11459. By Leonard Richardson on 2010-09-01
-
Corrected permissions.
- 11458. By Leonard Richardson on 2010-09-01
-
Renamed the *Verification interfaces to *Public to comply with existing naming standards.
- 11457. By Leonard Richardson on 2010-09-01
-
Fixed test failures.
- 11456. By Leonard Richardson on 2010-09-01
-
Merge with trunk.

lib/canonical/ launchpad/ pagetests/ webservice/ oauth.txt and most of the changes to lib/canonical/ launchpad/ doc/oauth. txt look like their primary purpose is to provide test coverage, not to provide documentation, so please write them as UnitTests.
A lot of the formatting of line-wraps doesn't match our official style: https:/ /dev.launchpad. net/PythonStyle Guide#Whitespac e%20and% 20Wrapping and often matches the "Do not indent your code like this" style. Please fix.
It appears that the removeSecurityProxy in lib/canonical/ launchpad/ webapp/ servers. py could be eliminated by moving some of the code into a method on OAuthAccessToken. Please try this, and if it's not possible, provide a follow-up comment explaining this.