2026-08-14 18:02:25 +02:00
|
|
|
"""Authorization helpers for operations that control host processes."""
|
|
|
|
|
from functools import wraps
|
|
|
|
|
|
|
|
|
|
from flask import abort
|
|
|
|
|
from flask_login import current_user, login_required
|
2026-08-21 18:46:19 +02:00
|
|
|
from .authorization import has_permission
|
2026-08-14 18:02:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def system_admin_required(view):
|
|
|
|
|
"""Restrict process-control operations to authenticated administrators."""
|
|
|
|
|
@wraps(view)
|
|
|
|
|
@login_required
|
|
|
|
|
def wrapped(*args, **kwargs):
|
2026-08-21 18:46:19 +02:00
|
|
|
if not has_permission("system.configure", current_user):
|
2026-08-14 18:02:25 +02:00
|
|
|
abort(403)
|
|
|
|
|
return view(*args, **kwargs)
|
|
|
|
|
|
|
|
|
|
return wrapped
|