Ticket #4959 (closed defect: fixed)

Opened 4 years ago

Last modified 2 years ago

inconsistent error handling

Reported by: mkc Assigned to: 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

fix_error_handling.patch (0.6 kB) - added by olistudent on 01/28/10 14:55:54.
Display greyed out comment box instead of macro error

Change History

01/28/10 14:55:54 changed by olistudent

  • attachment fix_error_handling.patch added.

Display greyed out comment box instead of macro error

09/10/10 16:12:34 changed by osimons

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #4959 (inconsistent error handling)




Change Properties
Action