fix(admin): gate overpay certificate block by settings permission

(cherry picked from commit 28068bbe45221145df3bd580a46e7bd7fce416e9)
This commit is contained in:
Boris Kovalskii
2026-06-11 22:36:35 +10:00
committed by Fringg
parent f52360449b
commit ecc2d45562
5 changed files with 23 additions and 4 deletions

View File

@@ -1638,6 +1638,7 @@
"quickAmountsRemove": "Remove amount {{value}} ₽",
"overpayCertTitle": "mTLS certificate (Overpay)",
"overpayCertValid": "✅ Valid until {{date}}",
"overpayCertExpired": "⚠️ Expired {{date}}",
"overpayCertUnreadable": "⚠️ Certificate cannot be read — wrong passphrase or corrupted file",
"overpayCertMissing": "❌ Certificate not uploaded",
"overpayCertEnvLockedPath": "Path is set via the OVERPAY_P12_PATH environment variable — the database value is not applied",

View File

@@ -2315,6 +2315,7 @@
"quickAmountsRemove": "حذف مبلغ {{value}} ₽",
"overpayCertTitle": "گواهی mTLS (Overpay)",
"overpayCertValid": "✅ معتبر تا {{date}}",
"overpayCertExpired": "⚠️ در تاریخ {{date}} منقضی شده است",
"overpayCertUnreadable": "⚠️ گواهی قابل خواندن نیست — رمز نادرست یا فایل خراب است",
"overpayCertMissing": "❌ گواهی بارگذاری نشده است",
"overpayCertEnvLockedPath": "مسیر از طریق متغیر محیطی OVERPAY_P12_PATH تنظیم شده است — مقدار پایگاه داده اعمال نمی‌شود",

View File

@@ -1660,6 +1660,7 @@
"quickAmountsRemove": "Удалить сумму {{value}} ₽",
"overpayCertTitle": "Сертификат mTLS (Overpay)",
"overpayCertValid": "✅ Действует до {{date}}",
"overpayCertExpired": "⚠️ Срок действия истёк {{date}}",
"overpayCertUnreadable": "⚠️ Сертификат не читается — неверный пароль или повреждённый файл",
"overpayCertMissing": "❌ Сертификат не загружен",
"overpayCertEnvLockedPath": "Путь задан через переменную окружения OVERPAY_P12_PATH — значение из БД не применяется",

View File

@@ -1467,6 +1467,7 @@
"quickAmountsRemove": "删除金额 {{value}} ₽",
"overpayCertTitle": "mTLS 证书Overpay",
"overpayCertValid": "✅ 有效期至 {{date}}",
"overpayCertExpired": "⚠️ 已于 {{date}} 过期",
"overpayCertUnreadable": "⚠️ 证书无法读取——密码错误或文件损坏",
"overpayCertMissing": "❌ 未上传证书",
"overpayCertEnvLockedPath": "路径已通过环境变量 OVERPAY_P12_PATH 设置——数据库中的值不会生效",

View File

@@ -11,6 +11,7 @@ import { useHapticFeedback } from '../platform/hooks/useHaptic';
import { useDestructiveConfirm } from '../platform/hooks/useNativeDialog';
import { createNumberInputHandler, toNumber } from '../utils/inputHelpers';
import { localeMap } from '../utils/withdrawalUtils';
import { PermissionGate } from '@/components/auth/PermissionGate';
import { BackIcon, CheckIcon, SaveIcon } from '@/components/icons';
function extractErrorDetail(err: unknown): string | null {
@@ -94,6 +95,10 @@ function OverpayCertificateSection() {
})
: null;
const isExpired = certStatus?.not_valid_after
? new Date(certStatus.not_valid_after).getTime() < Date.now()
: false;
return (
<div className="card space-y-4">
<h3 className="text-sm font-semibold text-dark-200">
@@ -106,9 +111,15 @@ function OverpayCertificateSection() {
<div>
{certStatus.valid ? (
<>
<p className="text-sm text-success-400">
{t('admin.paymentMethods.overpayCertValid', { date: expiryDate })}
</p>
{isExpired ? (
<p className="text-sm text-warning-400">
{t('admin.paymentMethods.overpayCertExpired', { date: expiryDate })}
</p>
) : (
<p className="text-sm text-success-400">
{t('admin.paymentMethods.overpayCertValid', { date: expiryDate })}
</p>
)}
{certStatus.subject && (
<p className="mt-1 break-all text-xs text-dark-500">{certStatus.subject}</p>
)}
@@ -698,7 +709,11 @@ export default function AdminPaymentMethodEdit() {
</div>
</div>
{config.method_id === 'overpay' && <OverpayCertificateSection />}
{config.method_id === 'overpay' && (
<PermissionGate permission="settings:read">
<OverpayCertificateSection />
</PermissionGate>
)}
{/* Actions */}
<div className="flex items-center gap-3">