Skip to content

Commit

Permalink
Merge branch '501_criteria_synch_checking_discription' of github.com:…
Browse files Browse the repository at this point in the history
…moevm/mse_auto_checking_slides_vaganov into 501_criteria_synch_checking_discription
  • Loading branch information
MarinaProsche committed Apr 2, 2024
2 parents fdc8aaa + f98c325 commit e697420
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
33 changes: 33 additions & 0 deletions app/routes/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from flask import abort, Blueprint
from flask_login import current_user
from functools import wraps


admin = Blueprint('admin', __name__, template_folder='templates', static_folder='static')


def admin_required(route_func):
@wraps(route_func)
def my_wrapper(*args, **kwargs):
if current_user and current_user.is_admin:
return route_func(*args, **kwargs)
abort(403)
return my_wrapper


@admin.route('/', methods=["GET"])
@admin_required
def index():
return "There will be a list of all admin pages here"


@admin.route('/criterions', methods=["GET"])
@admin_required
def criterions():
return "There will be a list of all system (python classes) criterions"


@admin.route('/criterion/<criterion_id>', methods=["GET"])
@admin_required
def criterion(criterion_id):
return f"There will be a list of all database parametrized version of {criterion_id}"
4 changes: 4 additions & 0 deletions app/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from tasks import create_task
from utils import checklist_filter, decorator_assertion, get_file_len, format_check
from app.main.checks import CRITERIA_INFO
from routes.admin import admin

logger = get_root_logger('web')
UPLOAD_FOLDER = '/usr/src/project/files'
Expand All @@ -50,6 +51,9 @@
app.config['CELERY_RESULT_BACKEND'] = os.environ.get("CELERY_RESULT_BACKEND", "redis://localhost:6379")
app.config['CELERY_BROKER_URL'] = os.environ.get("CELERY_BROKER_URL", "redis://localhost:6379")

app.register_blueprint(admin, url_prefix='/admin')


app.logger.addHandler(get_logging_stdout_handler())
app.logger.propagate = False
login_manager = LoginManager()
Expand Down

0 comments on commit e697420

Please sign in to comment.