feat: Phase 6 — require_active_service decorator + wizard install wiring
Email/calendar/files routes now return 404 when the service is not installed, using a require_active_service decorator that checks ServiceRegistry. Status endpoints are exempt so health checks always work. SetupManager.complete_setup() now accepts a service_store_manager and installs any wizard-selected services in a background daemon thread after setup completes. Failures are logged but do not fail the wizard. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
from functools import wraps
|
||||
from flask import jsonify
|
||||
|
||||
|
||||
def require_active_service(service_id: str):
|
||||
"""Decorator: return 404 if the named service is not installed.
|
||||
|
||||
Apply to all email/calendar/files routes except /status endpoints,
|
||||
so the UI can always check installation state without being blocked.
|
||||
"""
|
||||
def decorator(fn):
|
||||
@wraps(fn)
|
||||
def wrapper(*args, **kwargs):
|
||||
from app import service_registry
|
||||
if service_registry.get(service_id) is None:
|
||||
return jsonify({'error': f'Service {service_id!r} is not installed'}), 404
|
||||
return fn(*args, **kwargs)
|
||||
return wrapper
|
||||
return decorator
|
||||
|
||||
Reference in New Issue
Block a user