实现账号信息隐藏权限系统

1. 拆分 account:view_all 和 account:view_full 权限
2. 运营只能看用户名、标签、分配,隐藏密码/邮箱等敏感信息
3. 管理员可看完整字段(需 account:view_full 权限)
4. 所有人都可分配账号给客服
5. 前端添加上传时间列
This commit is contained in:
yml2213
2026-06-24 22:15:46 +08:00
parent 09f9ab7165
commit 50f90eeeb8
3 changed files with 15 additions and 6 deletions
+10 -1
View File
@@ -7,6 +7,7 @@ import type { TableProps } from 'antd';
import { ImportOutlined, DeleteOutlined, TagOutlined, FilterOutlined } from '@ant-design/icons';
import { accountApi, userApi, type AccountItem, type UserInfo } from '../api/modules';
import { usePermissions } from '../hooks/usePermissions';
import { formatTime } from '../utils/time';
import { getErrorMessage } from '../utils/error';
const { TextArea } = Input;
@@ -36,6 +37,7 @@ export default function AccountsPage() {
const { can } = usePermissions();
const canViewAll = can('account:view_all');
const canViewFull = can('account:view_full');
const canImport = can('account:import');
const canAssign = can('account:assign');
const canDelete = can('account:delete');
@@ -218,9 +220,16 @@ export default function AccountsPage() {
return <Tag color={tagColorMap[tag]}>{tag}</Tag>;
},
},
{
title: '上传时间',
dataIndex: 'created_at',
width: 180,
render: (val: string | null) => val ? formatTime(val) : <Text type="secondary">-</Text>,
},
];
if (canViewAll) {
// 只有管理员可看完整字段(密码、邮箱等)
if (canViewFull) {
columns.push(
{ title: '密码', dataIndex: 'password', width: 120 },
{ title: '邮箱', dataIndex: 'email' },