e518bce922
Resolve all merge conflicts between our automation feature branch and current main (v0.163.0, 920 commits ahead). Conflicts resolved: - app/api/__init__.py: add automation_router alongside main's new routers (classification_rules, qr_auth, sessions, system_reset) - app/config.py: add main's new settings (dropbox_use_global_credentials, factory_reset_on_startup, enable_factory_reset) - app/models.py: add main's new models (ClassificationRuleModel, UserSession, QRLoginChallenge, SharePoint integration type) - app/utils/settings_service.py: merge automation_hooks_enabled with main's new metadata entries - docs/API.md: merge automation API docs with main's classification rules docs - docs/ConfigurationGuide.md: add factory reset settings - tests/conftest.py: import both AutomationHook and new main models Migration renumbered: - 037_add_automation_hooks → 040_add_automation_hooks - down_revision: 039_add_classification_rules (was 036_add_document_translation_fields) - Chain: 036 → 037 → 038 → 039 → 040 (automation hooks) For all non-automation files with conflicts, main's version was taken since our branch did not modify those files (conflicts were from a stale prior merge). Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/cb62f012-3b69-4415-835e-3857ce3e9f45
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""
|
|
System reset view — admin-only UI page.
|
|
|
|
Renders a confirmation-heavy page that allows administrators to:
|
|
1. **Full Reset** — wipe all user data (DB + disk) for a fresh start.
|
|
2. **Reset & Re-import** — move originals to a reimport folder, wipe,
|
|
and let the watch-folder mechanism re-ingest them.
|
|
|
|
Both options are gated behind the ``ENABLE_FACTORY_RESET`` feature flag.
|
|
"""
|
|
|
|
import logging
|
|
|
|
from fastapi import Depends, Request
|
|
from fastapi.responses import RedirectResponse, Response
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.config import settings
|
|
from app.views.base import APIRouter, get_db, require_login, templates
|
|
from app.views.settings import require_admin_access
|
|
|
|
logger = logging.getLogger(__name__)
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/admin/system-reset")
|
|
@require_login
|
|
@require_admin_access
|
|
async def system_reset_page(request: Request, db: Session = Depends(get_db)) -> Response:
|
|
"""Render the system reset administration page."""
|
|
if not settings.enable_factory_reset:
|
|
return RedirectResponse(url="/settings", status_code=302)
|
|
|
|
return templates.TemplateResponse(
|
|
"system_reset.html",
|
|
{
|
|
"request": request,
|
|
"factory_reset_on_startup": settings.factory_reset_on_startup,
|
|
},
|
|
)
|