Pull requests

#155 Merged
Repository
inducer
Branch
default
Repository
thomaswaldmann
Branch
default

Catch AccessDenied errors originating in item.do_show.

Author
  1. Andreas Kloeckner
Reviewers
Description

This fix avoids a 500 server error with the following traceback:

Traceback (most recent call last):
  File "/home/andreas/pack/moin2/mypy/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py", line 1687, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/andreas/pack/moin2/mypy/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py", line 1360, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/andreas/pack/moin2/mypy/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py", line 1358, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/andreas/pack/moin2/mypy/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py", line 1344, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/apps/frontend/views.py", line 353, in show_item
    return item.do_show(rev)
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/items/__init__.py", line 776, in do_show
    content = self._select_itemtype()
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/items/__init__.py", line 792, in _select_itemtype
    itemtypes=item_registry.shown_entries,
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/util/clock.py", line 62, in wrapper
    retval = f(*args, **kw)
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/themes/__init__.py", line 52, in render_template
    return render_theme_template(get_current_theme(), template, **context)
  File "/home/andreas/pack/moin2/mypy/local/lib/python2.7/site-packages/Flask_Themes-0.1.3.1-py2.7.egg/flaskext/themes.py", line 475, in render_theme_template
    return render_template(template_name, **context)
  File "/home/andreas/pack/moin2/mypy/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/templating.py", line 125, in render_template
    context, ctx.app)
  File "/home/andreas/pack/moin2/mypy/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/templating.py", line 107, in _render
    rv = template.render(context)
  File "/home/andreas/pack/moin2/mypy/local/lib/python2.7/site-packages/Jinja2-2.6-py2.7.egg/jinja2/environment.py", line 894, in render
    return self.environment.handle_exception(exc_info, True)
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/templates/modify_select_itemtype.html", line 1, in top-level template code
    {% extends theme("show.html") %}
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/templates/show.html", line 33, in top-level template code
    <span class="moin-disabled">{{ _('no newer revision') }}</span>
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/templates/layout.html", line 11, in top-level template code
    {% set credits = snippets.credits() %}
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/templates/base.html", line 59, in top-level template code
    {% block layout %}
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/templates/layout.html", line 140, in block "layout"
    {% block subitem_navigation %}{% endblock %}
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/templates/show.html", line 40, in block "subitem_navigation"
    {{ utils.render_subitem_navigation(item_name, False) }}
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/templates/utils.html", line 93, in template
    {{ _render_subitem_navigation_tree(subitems, newtab, mycaller) }}
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/templates/utils.html", line 74, in template
    {{ _render_subitem_navigation_tree(theme_supp.subitem_index(e.fullname), newtab, parentcaller) }}
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/themes/__init__.py", line 129, in subitem_index
    return item.get_mixed_index()
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/items/__init__.py", line 613, in get_mixed_index
    dirs, files = self.make_flat_index(self.get_subitem_revs())
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/util/clock.py", line 62, in wrapper
    retval = f(*args, **kw)
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/items/__init__.py", line 581, in make_flat_index
    direct_rev = get_storage_revision(direct_fullname)
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/items/__init__.py", line 160, in get_storage_revision
    rev = item.get_revision(rev_id)
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/storage/middleware/protecting.py", line 292, in get_revision
    return self[revid]
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/storage/middleware/protecting.py", line 287, in __getitem__
    self.require(READ, PUBREAD)
  File "/home/andreas/pack/moin2/moin-2.0/MoinMoin/storage/middleware/protecting.py", line 278, in require
    self.protector.user.name, capability, self.item.acl))
AccessDenied: item does not allow user '[u'AndreasKloeckner']' to ''read or pubread'' [u'AshishMyles:read,write,admin WesleyPegden:read,write,admin MattElsey:read,write,admin All:']
  • Learn about pull requests

Comments (0)