Modify

Opened 15 years ago

Closed 14 years ago

Last modified 13 years ago

#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)

fix_error_handling.patch (602 bytes) - added by Oliver Metz 14 years ago.
Display greyed out comment box instead of macro error

Download all attachments as: .zip

Change History (2)

Changed 14 years ago by Oliver Metz

Attachment: fix_error_handling.patch added

Display greyed out comment box instead of macro error

comment:1 Changed 14 years ago by osimons

Resolution: fixed
Status: newclosed

(In [8745]) AddCommentMacro: Not raise an error for permission issue. Render the form with all fields disabled instead. Closes #4959.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Alec Thomas.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.