-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '501_criteria_synch_checking_discription' of github.com:…
…moevm/mse_auto_checking_slides_vaganov into 501_criteria_synch_checking_discription
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters