fix: 权限组去掉分享开关

分享不参与判定,界面不再配置这一项。
This commit is contained in:
chenpei 2026-08-20 17:09:46 +08:00
parent d4e9a9bc87
commit d196033b13
3 changed files with 4 additions and 3 deletions

View File

@ -258,7 +258,7 @@ export async function PUT(request: NextRequest) {
canView: Boolean(item.canView),
canDownload: Boolean(item.canDownload),
canDownloadSource: Boolean(item.canDownloadSource),
canShare: item.canShare !== false,
canShare: true,
})),
)
return NextResponse.json({ ok: true })

View File

@ -73,6 +73,7 @@ describe('PermissionGroupsDashboard', () => {
expect(within(screen.getByRole('navigation', { name: '权限组' })).getByRole('button', { name: /运营/ })).toBeInTheDocument()
expect(screen.getByText('已在本组')).toBeInTheDocument()
expect(screen.getByRole('columnheader', { name: '可见' })).toBeInTheDocument()
expect(screen.queryByRole('columnheader', { name: '分享' })).not.toBeInTheDocument()
expect(screen.getByRole('link', { name: '按人看权限' })).toHaveAttribute(
'href',
'/workspaces/governance/user-permissions',

View File

@ -49,11 +49,10 @@ type Payload = {
groups: Group[]
}
const FLAG_COLUMNS: Array<{ key: keyof MaterialPermissionFlags; label: string }> = [
const FLAG_COLUMNS: Array<{ key: Exclude<keyof MaterialPermissionFlags, 'canShare'>; label: string }> = [
{ key: 'canView', label: '可见' },
{ key: 'canDownload', label: '下载' },
{ key: 'canDownloadSource', label: '源文件' },
{ key: 'canShare', label: '分享' },
]
const emptyFlags = (): MaterialPermissionFlags => ({
@ -250,6 +249,7 @@ export default function PermissionGroupsDashboard() {
permissions: payload.materialTypes.map((materialType) => ({
materialType,
...(selectedFlags[materialType] || emptyFlags()),
canShare: true,
})),
},
'这组权限已保存,组和人一起变',