Add 'use main stack settings' toggle for third-party integration credentials

Each of Newbook, Resos, SambaPOS, SMTP, and Nextcloud now has a checkbox at the
top of its credentials block. When enabled, the app reads auth credentials from
the central stack settings service (SETTINGS_URL + STACK_INTERNAL_SECRET) and
the local auth fields are grayed out. App-specific fields (base path, GL codes,
keywords, sync intervals, etc.) remain editable regardless.

Backend: new use_global_* columns on kitchen_settings, migration, global_settings_service
with apply_global_overrides() for in-memory credential injection, GET /api/settings/global-status
endpoint, and apply_global_overrides() called in test-connection endpoints and FileArchivalService.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-12 21:57:10 +00:00
parent 62417d59de
commit d7898ba897
10 changed files with 356 additions and 34 deletions

View file

@ -214,6 +214,13 @@ class KitchenSettings(Base):
"dispute_email": True, "duplicate_detection": True, "supplier_alias": True, "yield_estimation": True
})
# Global settings flags — use central stack settings auth credentials for each integration
use_global_smtp: Mapped[bool] = mapped_column(Boolean, default=False)
use_global_nextcloud: Mapped[bool] = mapped_column(Boolean, default=False)
use_global_newbook: Mapped[bool] = mapped_column(Boolean, default=False)
use_global_resos: Mapped[bool] = mapped_column(Boolean, default=False)
use_global_sambapos: Mapped[bool] = mapped_column(Boolean, default=False)
# Internal API key (for in-house apps like menu display plugin)
api_key: Mapped[str | None] = mapped_column(String(100), nullable=True)
api_key_enabled: Mapped[bool] = mapped_column(Boolean, default=False)