Skip to content

Receipt-settings startup race and role-based printing permissions #1225

Closed

Description

@khaira777

Summary

Follow-up to PR #1202 / Issue #1188 (Frontend browser-print receipt settings remain stale until Settings page is opened).

Problem

  1. Startup Race: Browser printing reads usePosSettingsStore.getState() synchronously. When an order is completed or printed immediately upon app startup or navigation before useReceiptSettingsSync has completed its asynchronous GET /settings/business request, printing renders default/stale merchant information.
  2. Role-Based Printing Permissions: Under FloCafe's authorization model, staff roles who generate and print receipts (such as cashier or a server with payment/bill permissions) have bills.read, bills.generate, and payments.take, but are not granted general settings administrative privileges (settings.view or settings.manage). Currently, GET /settings/business requires requirePermission('settings.view'), and useReceiptSettingsSync guards execution with if (!tenantCan(currentTenant, 'settings.view')) return;. Consequently, non-admin staff who are authorized to print receipts are locked out of reading storefront receipt settings, resulting in customer receipts lacking store address, phone, logo, or tax registration details.

Acceptance Criteria

  1. Allow roles authorized to print or read bills (settings.view, bills.read, bills.print, orders.read, bills.generate) to read storefront business receipt settings (GET /settings/business) without granting general settings administrative privileges (settings.manage or broad access to other settings).
  2. Update useReceiptSettingsSync and usePrinter to ensure receipt settings are loaded before printing occurs, with safe fallback to existing/default settings if offline or unavailable.
  3. Add automated tests covering role-based receipt settings access and startup race prevention.

Activity

  1. khaira777 commented on Oct 20, 2026

    @khaira777
    ContributorAuthor

    Verified and delivered on main via PR #1226 (a7d410d5c52d7af753d1f964040165472f20ecb8).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions