17 lines
362 B
Python
17 lines
362 B
Python
from __future__ import annotations
|
|
|
|
from functools import wraps
|
|
|
|
from flask import abort
|
|
from flask_login import current_user
|
|
|
|
|
|
def admin_required(func):
|
|
@wraps(func)
|
|
def wrapper(*args, **kwargs):
|
|
if not current_user.is_authenticated or not current_user.is_admin():
|
|
abort(403)
|
|
return func(*args, **kwargs)
|
|
|
|
return wrapper
|