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

« back to all changes in this revision

Viewing changes to ivle/webapp/filesystem/serve/__init__.py

Don't shadow the dispatch-called authorize() in ServeView.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
    def serve(self, req, owner, jail, path):
59
59
        self.serve_file(req, owner, jail, path)
60
60
 
61
 
    def authorize(self, req):
 
61
    def path_authorize(self, req):
62
62
        """Given a request, checks whether req.username is allowed to
63
63
        access req.path. Returns True on authz success, False on failure.
 
64
 
 
65
        This can't be done in the usual authorize(), because we rely on the
 
66
        jail being mounted.
64
67
        """
65
68
        # Private mode authorization: standard (only logged in user can access
66
69
        # their own files, and can access all of them).
84
87
        interpret.interpret_file(req, owner, jail, '', noop_object)
85
88
 
86
89
        # Authorize access. If failure, this throws a HTTP_FORBIDDEN error.
87
 
        if not self.authorize(req):
 
90
        if not self.path_authorize(req):
88
91
            raise Unauthorized()
89
92
 
90
93
        args = []