Paradaux

PAR-237

0

Grant secretaries access to view department account transactions

Pending ReleaserianTreasuryFeature

Enable secretaries to view the transactions for their respective Department accounts without exposing all trade-by-trade logs. This change is aimed at improving transparency and access for department leadership.

Resources

Comments

tesks · Jun 21, 2026, 9:01 PM

Done — read-only "viewer" tier for government accounts (both phases green on CI)

Model decision: members can already view a department's ledger history (which is summary-level, never trade-by-trade), but membership also grants spending — so there was no view-only tier. Added a third, lowest tier — viewer — scoped per-department, mirroring the member/group-member model.

Part 1 — Treasury plugin (commit bf1c1d3)

  • V18 migration: account_viewers (direct UUID) + account_group_viewers (LuckPerms group), soft-deleted, standalone (no member-FK like authorizers).
  • MembershipService.isViewer + canView (member OR viewer; no spend/manage) + viewer CRUD; mapper SQL for both.
  • GovCommand: /government account balance + history now gate on canView (admin, member, or viewer); new /government account viewer add|remove|addgroup|removegroup|list, gated like member management (authorizer + treasury.gov.account.manage).
  • plugin.yml + messages updated; the admin guide documents the three tiers.
  • Tests: unit covers the new service methods (incl. the LuckPerms group path); IT validates the SQL end-to-end (a viewer reads but is neither member nor authorizer). 95% coverage gate passes.

Part 2 — Economy Explorer (commit 5a0f25b)

  • The account-detail page gated history on staff/owner/firm-finance only — so even a government-account member couldn't see it on the web. Added canReadAccount(accountId, uuid) (active member/authorizer/viewer) into the page's canSeeHistory, scoped to the specific account.
  • The page renders only ledger postings — the per-trade chestshop_sale breakdown lives on the market pages, never here — so "ledger summaries, not trade-by-trade" holds on the web too.
  • Integration test asserts a viewer sees their department's account, not an unrelated one, and a stranger is denied.

How ops grant a secretary

In-game: /government account viewer add <Dept> <player> (or addgroup <Dept> <lp-group>). Web history access is by UUID viewer/member/authorizer (LuckPerms-group grants resolve in-game only, since the explorer has no live LuckPerms).

Verified locally and on CI: Treasury Test & Coverage + Economy Explorer CI both green on 5a0f25b.

Activity

  • ParadauxIO linked a commit — Commit 93b6c82 — Unify account read-access on shared SQL views (ADT-13)
  • ParadauxIO linked a commit — Commit 0961a98 — Consolidate account members/authorizers/viewers into one account_access table (PAR-249)
  • tesks changed status to Status → Pending Release
  • tesks commented
  • ParadauxIO linked a commit — Commit 5a0f25b — Show a department secretary their account's history on the explorer (PAR-237, part 2)
  • ParadauxIO linked a commit — Commit bf1c1d3 — Add a read-only viewer tier for government accounts (PAR-237, part 1: in-game)
  • tesks changed status to Status → In Progress
  • tesks created the issue