Merge lp:~adeuring/launchpad/product-lp-limitedview-3-1 into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Abel Deuring on 2012-11-13 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 16263 |
| Proposed branch: | lp:~adeuring/launchpad/product-lp-limitedview-3-1 |
| Merge into: | lp:launchpad |
| Diff against target: |
83 lines (+39/-23) 2 files modified
lib/lp/app/browser/launchpad.py (+26/-23) lib/lp/app/browser/tests/test_launchpad.py (+13/-0) |
| To merge this branch: | bzr merge lp:~adeuring/launchpad/product-lp-limitedview-3-1 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Francesco Banconi (community) | 2012-11-13 | Approve on 2012-11-13 | |
|
Review via email:
|
|||
Commit Message
LaunchpadRootNa
Description of the Change
This branch changes the permission check in
LaunchpadRootNa
If the current request URL is related to pillar, i.e., if it does
not start with a '~', traverse() tries to find a pillar with
the given name.
If the pillar exists and if the current user has the permission
launchpad.View for the pillar, it is returned by the method.
Otherwise, None is returned.
The permission current check "may the user view this product?" does
not work correctly in the following situation:
- The URL points to a branch, bug or specification of a proprietary
or embargoed product
- The current user has a artifact grant for the branch/bug/spec
but does not have a policy grant for the product.
In this case, a user has the permission launchpad.
the product, but not the permission launchpad.View, so traverse()
should chekc if the user has the permission lp.LimitedView.
(This permission is required for attributes like IProduct.name or
IProduct.
pages.)
This check is similar to that for private teams, a few lines up
in the same method.
So the core change is simply
s/check_
The method already had a special rule for inactive products:
- if (pillar is not None and IProduct.
- not pillar.active):
In order to keep the if (...) expressions readable, I refactored the
checks "pillar is None", "IProduct.
"pillar.active".
test:
./bin/test app -vvt test_access_
no lint
| Abel Deuring (adeuring) wrote : | # |
wgrant noted that we can use the permission lp.LimitedView not only for IProduct but for IDistribution too, so I simplyfied the checks in traverse() a bit.

Looks good to me Abel, thank you.