Modify ↓
Opened 8 years ago
Closed 8 years ago
#12891 closed defect (fixed)
Renaming a template containing a form to move it into a private wiki
Reported by: | ntmlod | Owned by: | Nathan Lewis |
---|---|---|---|
Priority: | normal | Component: | PrivateWikiPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.0 |
Description
I'm not sure if PrivateWikiPlugin is in question in that case because it's tricky for me with multiples plugins in cross-use:
PrivateWikiPlugin | 1.0.0 |
TracFormsPlugin | 0.5dev |
TracWikiNotification | 0.4.2 |
Here is the log extract when Trac crashed while checking the permission FORM_VIEW
:
2016-10-07 19:21:13,468 Trac[api] DEBUG: Attempting to protect against WIKI_VIEW 2016-10-07 19:21:13,479 Trac[api] DEBUG: Checking permission called with: action(PRIVATE_EDIT_censored), username(censored), resource(None), perm(<trac.perm.PermissionCache object at 0x30e3910>) 2016-10-07 19:21:13,479 Trac[api] DEBUG: Checking permission called with: action(PERMISSION_ADMIN), username(censored), resource(None), perm(<trac.perm.PermissionCache object at 0x30e3910>) 2016-10-07 19:21:13,482 Trac[api] DEBUG: Checking permission called with: action(FORM_VIEW), username(censored), resource(<Resource u'wiki:PageTemplates/censored, form'>), perm(<trac.perm.PermissionCache object at 0x324e050>) 2016-10-07 19:21:13,484 Trac[main] ERROR: Internal Server Error: Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/trac/web/main.py", line 497, in _dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.7/site-packages/trac/web/main.py", line 214, in dispatch resp = chosen_handler.process_request(req) File "/usr/lib/python2.7/site-packages/trac/wiki/web_ui.py", line 154, in process_request return self._do_rename(req, page) File "/usr/lib/python2.7/site-packages/trac/wiki/web_ui.py", line 313, in _do_rename page.rename(new_name) File "/usr/lib/python2.7/site-packages/trac/wiki/model.py", line 197, in rename listener.wiki_page_renamed(self, old_name) File "build/bdist.linux-x86_64/egg/WikiNotification/listener.py", line 76, in wiki_page_renamed wne.notify("renamed", page, author=author, ipnr=ipnr, redirect=redirect, old_name=old_name) File "build/bdist.linux-x86_64/egg/WikiNotification/notification.py", line 154, in notify NotifyEmail.notify(self, page.name, subject) File "/usr/lib/python2.7/site-packages/trac/notification.py", line 344, in notify Notify.notify(self, resid) File "/usr/lib/python2.7/site-packages/trac/notification.py", line 230, in notify (torcpts, ccrcpts) = self.get_recipients(resid) File "build/bdist.linux-x86_64/egg/WikiNotification/notification.py", line 171, in get_recipients if sid[0] != self.change_author and perm.check_permission(action='WIKI_VIEW', username=sid[0], resource=resource): File "/usr/lib/python2.7/site-packages/trac/perm.py", line 462, in check_permission perm) File "build/bdist.linux-x86_64/egg/privatewiki/api.py", line 44, in check_permission return self.check_wiki_access(perm, resource, action, wiki.name) File "build/bdist.linux-x86_64/egg/privatewiki/api.py", line 88, in check_wiki_access if ('PRIVATE_ALL_VIEW' in perm(res) TypeError: 'NoneType' object is not callable
I find a very "rough" workaround solution in appending TRAC-ADMIN
as a case for access permission but I'm pretty sure it's not the smart fix.
-
privatewiki/api.py
85 85 self.env.log.debug('Attempting to protect against %s' % action) 86 86 87 87 if action == 'WIKI_VIEW': 88 if ('PRIVATE_ALL_VIEW' in perm(res)88 if ('PRIVATE_ALL_VIEW' or 'TRAC_ADMIN' in perm(res) 89 89 or view_perm in perm(res) 90 90 or edit_perm in perm(res)): 91 91 … … 93 93 return True 94 94 95 95 elif action in ('WIKI_MODIFY', 'WIKI_CREATE'): 96 if ('PRIVATE_ALL_EDIT' in perm(res)96 if ('PRIVATE_ALL_EDIT' or 'TRAC_ADMIN' in perm(res) 97 97 or edit_perm in perm(res)): 98 98 99 99 self.env.log.debug('--Can MODIFY or CREATE')
Attachments (0)
Change History (4)
comment:1 Changed 8 years ago by
comment:4 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
I believe the fix is incorrect.
('PRIVATE_ALL_VIEW' or 'TRAC_ADMIN' in perm(res) ...)
is always True.privatewikiplugin/trunk/privatewiki/api.py
('PRIVATE_ALL_VIEW' in perm(res)or view_perm in perm(res)oredit_perm in perm(res)):('PRIVATE_ALL_EDIT' in perm(res)oredit_perm in perm(res)):