Modify ↓
#4959 closed defect (fixed)
inconsistent error handling
| Reported by: | Michael Ching | Owned by: | Alec Thomas |
|---|---|---|---|
| Priority: | normal | Component: | AddCommentMacro |
| Severity: | normal | Keywords: | |
| Cc: | Trac Release: | 0.11 |
Description
read-only pages do not raise a TracError when there are insufficient privileges. In the case of an unprivileged user, they will see a grayed out form for readonly pages, but an error for normal pages.
One of the following changes should make it consistent. We opted for simply removing the TracError because it seems more graceful to show the grayed out form rather than an error.
From:
if page.readonly:
if 'WIKI_ADMIN' in req.perm(resource):
cancomment = True
elif 'WIKI_MODIFY' in req.perm(resource):
cancomment = True
elif appendonly and 'WIKI_VIEW' in req.perm(resource):
cancomment = True
else:
raise TracError('Error: Insufficient privileges to AddComment')
To:
if page.readonly:
if 'WIKI_ADMIN' in req.perm(resource):
cancomment = True
elif 'WIKI_MODIFY' in req.perm(resource):
cancomment = True
elif appendonly and 'WIKI_VIEW' in req.perm(resource):
cancomment = True
Or:
if page.readonly:
if 'WIKI_ADMIN' in req.perm(resource):
cancomment = True
else:
raise TracError('Error: Insufficient privileges to AddComment')
elif 'WIKI_MODIFY' in req.perm(resource):
cancomment = True
elif appendonly and 'WIKI_VIEW' in req.perm(resource):
cancomment = True
else:
raise TracError('Error: Insufficient privileges to AddComment')
Attachments (1)
Change History (2)
Changed 16 years ago by
| Attachment: | fix_error_handling.patch added |
|---|
comment:1 Changed 15 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
(In [8745]) AddCommentMacro: Not raise an error for permission issue. Render the form with all fields disabled instead. Closes #4959.
Note: See
TracTickets for help on using
tickets.



Display greyed out comment box instead of macro error