From f7503e1a91cb9946a3fe18f016a1133a9fd11f7b Mon Sep 17 00:00:00 2001 From: Joao Paulo Furtado Date: Sun, 10 May 2026 16:53:43 -0700 Subject: [PATCH] fix: restrict admin credit grants to internal API --- messages/en.json | 7 +- src/pages/admin/dashboard/credits.vue | 129 +----------------- .../_backend/private/admin_credits.ts | 23 +--- .../admin-credits-auth-boundary.unit.test.ts | 21 +++ tests/admin-credits.test.ts | 52 ++----- 5 files changed, 50 insertions(+), 182 deletions(-) create mode 100644 tests/admin-credits-auth-boundary.unit.test.ts diff --git a/messages/en.json b/messages/en.json index f90fc3288d..e2bb0b73ff 100644 --- a/messages/en.json +++ b/messages/en.json @@ -180,23 +180,24 @@ "admin-credits-col-notes": "Notes", "admin-credits-col-org": "Organization", "admin-credits-current-balance": "Current Balance", - "admin-credits-description": "Grant credits to customer organizations. All grants are logged with admin user ID.", + "admin-credits-description": "Review customer credit balances, grant history, and credit usage analytics.", "admin-credits-expires": "Next expiration", "admin-credits-expires-months": "Expires in (months)", "admin-credits-grant-button": "Grant {amount} Credits", "admin-credits-grant-error": "Failed to grant credits. Please try again.", "admin-credits-grant-success": "Successfully granted {amount} credits to {org}", - "admin-credits-grant-title": "Grant Credits to Organization", + "admin-credits-lookup-title": "Organization Credit Lookup", "admin-credits-grants-load-error": "Failed to load grant history. Please try again.", "admin-credits-no-balance": "No credits yet", "admin-credits-no-grants": "No admin grants yet", "admin-credits-notes-label": "Notes (optional)", "admin-credits-notes-placeholder": "Reason for granting credits...", "admin-credits-recent-grants": "Recent Admin Grants", + "admin-credits-readonly-note": "Credit grants are handled through internal operations.", "admin-credits-search-error": "Failed to search organizations. Please try again.", "admin-credits-search-placeholder": "Search by name, email, or org ID...", "admin-credits-select-org": "Select Organization", - "admin-credits-title": "Grant Credits", + "admin-credits-title": "Credits", "admin-dashboard": "Admin Dashboard", "admin-users-email-type-breakdown": "Email Type Breakdown", "admin-users-email-type-breakdown-description": "Registration mix in the selected period, split between professional, personal, and disposable email domains.", diff --git a/src/pages/admin/dashboard/credits.vue b/src/pages/admin/dashboard/credits.vue index 7eea13a2ec..4331251d82 100644 --- a/src/pages/admin/dashboard/credits.vue +++ b/src/pages/admin/dashboard/credits.vue @@ -4,7 +4,6 @@ meta: