Exemplo n.º 1
0
def show_current_session(session_id=None):
    if session_id is None:
        return redirect('/session/viewall')

    db = Database()
    # get all current entries and load up
    session_name = db.get_session_name(session_id)
    entries = []
    for db_entry in db.get_entries_for_session(session_id):
        entry = {
            'entry_id': db_entry['entry_id'],
            'value': db_entry['value'],
            'time_created': db_entry['time_created']
        }

        if not is_logged_in():
            entry['can_update'] = False
        else:
            if db.is_user_id_administrator(
                    flask_session['user_id']
            ) or db_entry['creator_id'] == flask_session['user_id']:
                entry['can_update'] = True
        entries.append(entry)
    return render_template('view_session.html',
                           session_name=session_name,
                           entries=entries)
Exemplo n.º 2
0
def set_session(session_id):
    db = Database()
    name = db.get_session_name(session_id)
    set_current_session(session_id, name)
    session['session_id'] = session_id
    return redirect('/session/view/' + str(session_id))
Exemplo n.º 3
0
def select_session(session_id):
    db = Database()
    name = db.get_session_name(session_id)
    set_current_session(session_id, name)
    session['session_id'] = session_id
    return redirect('/session/console')