fix(worker-platform): restrict withdrawal blacklist actions to admin role only
This commit is contained in:
@@ -123,7 +123,7 @@ router.post(
|
||||
|
||||
router.post(
|
||||
'/worker-platform/workers/:workerId/withdrawal-blacklist',
|
||||
requireAdminRoles(['admin', 'operator']),
|
||||
requireAdminRoles(['admin']),
|
||||
createJsonHandler(
|
||||
(req) =>
|
||||
updateAdminWorkerWithdrawalBlacklist(String(req.params.workerId || ''), req.body || {}),
|
||||
|
||||
@@ -39,6 +39,7 @@ import type {
|
||||
WorkerUserStatistics,
|
||||
} from '@/types/worker-platform'
|
||||
import { ADMIN_DEFAULT_PAGE_SIZE, buildAdminTablePagination } from '@/utils/admin-pagination'
|
||||
import { getAdminRole } from '@/utils/admin-auth'
|
||||
import WorkerDetailDrawer from './WorkerDetailDrawer'
|
||||
import { formatMoney, formatWorkerStatus } from './shared'
|
||||
|
||||
@@ -115,6 +116,7 @@ function WorkerStatisticsBar({ statistics }: { statistics?: WorkerUserStatistics
|
||||
}
|
||||
|
||||
export default function WorkersPanel() {
|
||||
const isAdmin = getAdminRole() === 'admin'
|
||||
const { message, modal } = App.useApp()
|
||||
const queryClient = useQueryClient()
|
||||
const [searchParams, setSearchParams] = useSearchParams()
|
||||
@@ -612,13 +614,15 @@ export default function WorkersPanel() {
|
||||
<Button onClick={() => setCreditWorker(row)}>充值</Button>
|
||||
<Button onClick={() => setResetPasswordWorker(row)}>重置密码</Button>
|
||||
<Button onClick={() => void openWithdrawalAccountModal(row)}>提现信息</Button>
|
||||
{row.isWithdrawalBlacklisted ? (
|
||||
<Button onClick={() => handleRemoveFromBlacklist(row)}>移出提现黑名单</Button>
|
||||
) : (
|
||||
<Button danger onClick={() => handleAddToBlacklist(row)}>
|
||||
加入提现黑名单
|
||||
</Button>
|
||||
)}
|
||||
{isAdmin ? (
|
||||
row.isWithdrawalBlacklisted ? (
|
||||
<Button onClick={() => handleRemoveFromBlacklist(row)}>移出提现黑名单</Button>
|
||||
) : (
|
||||
<Button danger onClick={() => handleAddToBlacklist(row)}>
|
||||
加入提现黑名单
|
||||
</Button>
|
||||
)
|
||||
) : null}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user