add defaults templates
This commit is contained in:
@@ -4,6 +4,18 @@ from .event_logger import log_event, get_user_events, get_room_events, get_recen
|
||||
from .notification import create_notification, get_user_notifications, mark_notification_read, mark_all_notifications_read, get_unread_count, delete_notification, delete_old_notifications
|
||||
from .path_utils import clean_path, secure_file_path
|
||||
from .time_utils import timeago, format_datetime, parse_datetime
|
||||
from functools import wraps
|
||||
from flask import flash, redirect, url_for
|
||||
from flask_login import current_user
|
||||
|
||||
def admin_required(f):
|
||||
@wraps(f)
|
||||
def decorated_function(*args, **kwargs):
|
||||
if not current_user.is_authenticated or not current_user.is_admin:
|
||||
flash('You do not have permission to access this page.', 'error')
|
||||
return redirect(url_for('main.dashboard'))
|
||||
return f(*args, **kwargs)
|
||||
return decorated_function
|
||||
|
||||
__all__ = [
|
||||
'user_has_permission',
|
||||
|
||||
Reference in New Issue
Block a user