فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
fix(A03): scope backup restore authorization per company
davoodmehraban89 committed
Oct 19, 2026 at 18:43 UTC
0f1d5d3018131f03e0499c9303b4e66725613b1b
1 file changed
+5
-3
src/core/AuditService.js
+5
-3
@@ -59,13 +59,15 @@ class AuditServiceImpl {
59
rows.some(row => !row || row.companyId !== companyId)) {
60
throw new Error('مجوز بازیابی ممیزی نامعتبر است');
61
}
62
- authorizedRestoreTransactions.set(tx, { companyId, rows: new WeakSet(rows) });
62
+ const permissions = authorizedRestoreTransactions.get(tx) || new Map();
63
+ permissions.set(companyId, new WeakSet(rows));
64
+ authorizedRestoreTransactions.set(tx, permissions);
65
}
66
67
async restoreHistorical(tx, row) {
66
- const authorization = authorizedRestoreTransactions.get(tx);
68
+ const authorization = authorizedRestoreTransactions.get(tx)?.get(row?.companyId);
69
if (!authorization || !authorization.rows.has(row) ||
68
- authorization.companyId !== row?.companyId) {
70
+ !validId(row.companyId)) {
71
throw new Error('بازیابی مستقیم ممیزی خارج از جریان مجاز است');
72
}
73
if (!row || typeof row !== 'object' || Array.isArray(row) ||