Ticket #6211 (reopened defect)
IPermissionPolicy unable to grant WIKI_VIEW access
| Reported by: | dkg-debian.org@… | Owned by: | cboos |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.11.3 |
| Component: | general | Version: | devel |
| Severity: | normal | Keywords: | permissions patch authzpolicy |
| Cc: |
Description
I'm working on a simple plugin which provides an IPermissionPolicy interface. The goal is for it to grant WIKI_VIEW privileges for certain objects, but not for the wiki as a whole. The current code (0.11dev, as of r6060) doesn't seem to allow this functionality except for the start page -- and then only when accessed as the root, not as /wiki/WikiStart.
Attempts to access /wiki/whatever (when the IPermissionPolicy object grants permission, but the user does not have generic WIKI_VIEW) fail with the error message:
No handler matched request to /wiki/whatever
The following patch seems correct to me, and seems to make things to work the way i expected them to (i.e. the IPermissionPolicy is now capable of granting WIKI_VIEW on specific resources and those resources are actually viewable, while others are not):
Index: trac/wiki/web_ui.py
===================================================================
--- trac/wiki/web_ui.py (revision 6060)
+++ trac/wiki/web_ui.py (working copy)
@@ -94,7 +94,7 @@
def match_request(self, req):
match = re.match(r'^/wiki(?:/(.*)|$)', req.path_info)
- if 'WIKI_VIEW' in req.perm('wiki') and match:
+ if match:
if match.group(1):
req.args['page'] = match.group(1)
return 1
I believe this just removes a shortcut that's no longer relevant under the new permissions model. It does not appear to grant additional, unwarranted access privileges in the cases i've tested, though i'd welcome any corrections.
Thanks for trac!


