~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/dispatch/__init__.py

Implement an authorization system in the new framework. This breaks the REST
views, but the rest have authorization information now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
from ivle.dispatch.request import Request
47
47
from ivle.dispatch import login
48
48
from ivle.webapp.base.plugins import ViewPlugin
49
 
from ivle.webapp.errors import HTTPError
 
49
from ivle.webapp.errors import HTTPError, Unauthorized
50
50
import apps
51
51
import html
52
52
 
157
157
        try:
158
158
            # Instantiate the view, which should be a BaseView class
159
159
            view = viewcls(req, **kwargs)
 
160
 
 
161
            # Check that the request (mainly the user) is permitted to access
 
162
            # the view.
 
163
            if not view.authorize(req):
 
164
                raise Unauthorized()
160
165
            # Render the output
161
166
            view.render(req)
162
167
        except HTTPError, e: