mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-18 06:24:23 +01:00
Allowing admins to preview challenge board
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
from flask import current_app as app, render_template, request, redirect, abort, jsonify, json as json_mod, url_for, session
|
from flask import current_app as app, render_template, request, redirect, abort, jsonify, json as json_mod, url_for, session
|
||||||
|
|
||||||
from CTFd.utils import ctftime, authed, unix_time, get_kpm, can_view_challenges
|
from CTFd.utils import ctftime, authed, unix_time, get_kpm, can_view_challenges, is_admin
|
||||||
from CTFd.models import db, Challenges, Files, Solves, WrongKeys, Keys
|
from CTFd.models import db, Challenges, Files, Solves, WrongKeys, Keys
|
||||||
|
|
||||||
import time
|
import time
|
||||||
@@ -10,7 +10,7 @@ import logging
|
|||||||
def init_challenges(app):
|
def init_challenges(app):
|
||||||
@app.route('/challenges', methods=['GET'])
|
@app.route('/challenges', methods=['GET'])
|
||||||
def challenges():
|
def challenges():
|
||||||
if not ctftime():
|
if not is_admin() and not ctftime():
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
if can_view_challenges():
|
if can_view_challenges():
|
||||||
return render_template('chals.html')
|
return render_template('chals.html')
|
||||||
@@ -19,7 +19,7 @@ def init_challenges(app):
|
|||||||
|
|
||||||
@app.route('/chals', methods=['GET'])
|
@app.route('/chals', methods=['GET'])
|
||||||
def chals():
|
def chals():
|
||||||
if not ctftime():
|
if not is_admin() and not ctftime():
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
if can_view_challenges():
|
if can_view_challenges():
|
||||||
chals = Challenges.query.add_columns('id', 'name', 'value', 'description', 'category').order_by(Challenges.value).all()
|
chals = Challenges.query.add_columns('id', 'name', 'value', 'description', 'category').order_by(Challenges.value).all()
|
||||||
|
|||||||
Reference in New Issue
Block a user