16 lines
327 B
Python
16 lines
327 B
Python
from functools import wraps
|
|
|
|
from flask import abort
|
|
from flask_login import current_user
|
|
|
|
|
|
|
|
def admin_required(view):
|
|
@wraps(view)
|
|
def wrapped(*args, **kwargs):
|
|
if not current_user.is_authenticated or not current_user.is_admin():
|
|
abort(403)
|
|
return view(*args, **kwargs)
|
|
|
|
return wrapped
|