This file is indexed.

/usr/lib/python2.7/dist-packages/sagenb/flask_version/decorators.py is in python-sagenb 1.0.1+ds1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from functools import wraps
from flask import Flask, url_for, render_template, request, session, redirect, g, current_app
from flask_babel import Babel, gettext, ngettext, lazy_gettext
_ = gettext

from threading import Lock
global_lock = Lock()

def login_required(f):
    @wraps(f)
    def wrapper(*args, **kwds):
        if 'username' not in session:
            #XXX: Do we have to specify this for the publised
            #worksheets here?
            if request.path.startswith('/home/_sage_/'):
                g.username = 'guest'
                return f(*args, **kwds)
            else:
                return redirect(url_for('base.index', next=request.url))
        else:
            g.username = session['username']
        return f(*args, **kwds)
    return wrapper

def admin_required(f):
    @login_required
    @wraps(f)
    def wrapper(*args, **kwds):
        if not g.notebook.user_manager().user_is_admin(g.username):
            return current_app.message(_("You do not have permission to access this location"), cont=url_for('base.index'), username=g.username)
        return f(*args, **kwds)

    return wrapper

def guest_or_login_required(f):
    @wraps(f)
    def wrapper(*args, **kwds):
        if 'username' not in session:
            g.username = 'guest'
        else:
            g.username = session['username']
        return f(*args, **kwds)
    return wrapper

def with_lock(f):
    @wraps(f)
    def wrapper(*args, **kwds):
        with global_lock:
            return f(*args, **kwds)
    return wrapper