Modify

Opened 5 years ago

Closed 4 years ago

Last modified 3 years ago

#4959 closed defect (fixed)

inconsistent error handling

Reported by: mkc Owned by: athomas
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 olistudent 4 years ago.
Display greyed out comment box instead of macro error

Download all attachments as: .zip

Change History (2)

Changed 4 years ago by olistudent

Display greyed out comment box instead of macro error

comment:1 Changed 4 years ago by osimons

  • Resolution set to fixed
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from athomas. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.