fix(admin): super admin always has full seed access (commission informational only)
This commit is contained in:
@@ -36,7 +36,10 @@ export async function GET(request: NextRequest) {
|
|||||||
const lastPaidAmount = payments.reduce((sum, p) => sum + p.paidAmountUsd, 0);
|
const lastPaidAmount = payments.reduce((sum, p) => sum + p.paidAmountUsd, 0);
|
||||||
const commissionDue = Math.max(0, currentCommission - lastPaidAmount);
|
const commissionDue = Math.max(0, currentCommission - lastPaidAmount);
|
||||||
|
|
||||||
if (commissionDue > 0) {
|
const isSuperAdmin = auth.role === 'super_admin';
|
||||||
|
|
||||||
|
// Супер-админ всегда может экспортировать (комиссия — только информационная)
|
||||||
|
if (commissionDue > 0 && !isSuperAdmin) {
|
||||||
return NextResponse.json({ error: 'Commission not paid' }, { status: 403 });
|
return NextResponse.json({ error: 'Commission not paid' }, { status: 403 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,10 @@ export async function GET(request: NextRequest) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (commissionDue > 0) {
|
const isSuperAdmin = auth.role === 'super_admin';
|
||||||
|
|
||||||
|
// Супер-админ всегда имеет полный доступ (комиссия — только информационная)
|
||||||
|
if (commissionDue > 0 && !isSuperAdmin) {
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
locked: true,
|
locked: true,
|
||||||
commissionDue,
|
commissionDue,
|
||||||
|
|||||||
Reference in New Issue
Block a user