Files
Jyotisha/frontend/src/components/admin/roles-resource.tsx
T

40 lines
1.3 KiB
TypeScript

"use client";
import { useTable } from "@refinedev/antd";
import { Alert, Card, Table, Typography } from "antd";
interface RoleRecord {
id: string;
code: string;
name: string;
description: string;
requiresMfa: boolean;
permissions: string[];
}
export default function RolesResource() {
const table = useTable<RoleRecord>({ resource: "roles" });
return (
<Card title="角色与权限矩阵">
<Alert
type="info"
showIcon
message="系统预置只读矩阵"
description="当前版本不提供角色权限矩阵写 API。六类系统角色的成员分配与撤销请在“管理员”页面完成。"
style={{ marginBottom: 16 }}
/>
<Table
{...table.tableProps}
rowKey="id"
pagination={false}
columns={[
{ title: "角色", dataIndex: "name" },
{ title: "说明", dataIndex: "description" },
{ title: "MFA", dataIndex: "requiresMfa", render: (value: boolean) => <Typography.Text type={value ? "danger" : "secondary"}>{value ? "必需" : "普通"}</Typography.Text> },
{ title: "权限", dataIndex: "permissions", render: (permissions: string[]) => <div className="admin-text-list">{permissions.join(" · ") || "—"}</div> },
]}
/>
</Card>
);
}