def dashboard(): # Renders admin or user dashboards, depending on admin privileges of user if DBProxy.check_admin(get_email_from_request()): all_users = DBProxy.get_all_judges() # All judges in the system all_group_projects = DBProxy.get_all_group_projects( ) # All non-public projects public_projects = DBProxy.get_all_public_projects( ) # All public projects return render_template( 'admindashboard.html', all_users=all_users, all_group_projects=all_group_projects, public_projects=public_projects, selector_algorithms=pairselector_options, ) # Not admin, render user dashboard judge = DBProxy.get_judge(request.cookies.get('email')) all_public_projects = DBProxy.get_all_public_projects() filtered_public_projects = [ p for p in all_public_projects if judge not in p.judges ] return render_template('userdashboard.html', filtered_public_projects=filtered_public_projects)
def wrapper(*args, **kwargs): email = request.cookies.get('email', None) if not DBProxy.check_admin(email): abort(401) else: return fn(*args, **kwargs)