修复权限组编辑图片保存被写死与读取缺列,勾选状态可正常保存回显

This commit is contained in:
chenpei 2026-08-28 16:44:52 +08:00
parent 93656492ef
commit 4e6e2ba0d1
2 changed files with 6 additions and 4 deletions

View File

@ -77,7 +77,7 @@ export async function GET() {
canDownload: true,
canDownloadSource: true,
canShare: true,
canEditAssets: false,
canEditAssets: true,
},
},
inheritors: {
@ -259,6 +259,7 @@ export async function PUT(request: NextRequest) {
canDownload?: boolean
canDownloadSource?: boolean
canShare?: boolean
canEditAssets?: boolean
}> = Array.isArray(body?.permissions) ? body.permissions : []
if (incoming.length === 0) {
return NextResponse.json({ error: '素材类型列表不能为空' }, { status: 400 })
@ -271,7 +272,7 @@ export async function PUT(request: NextRequest) {
canDownload: Boolean(item.canDownload),
canDownloadSource: Boolean(item.canDownloadSource),
canShare: true,
canEditAssets: false,
canEditAssets: item.canEditAssets === true,
})),
)
return NextResponse.json({ ok: true })

View File

@ -40,7 +40,7 @@ export async function GET() {
canDownload: true,
canDownloadSource: true,
canShare: true,
canEditAssets: false,
canEditAssets: true,
},
},
},
@ -114,6 +114,7 @@ export async function PUT(request: NextRequest) {
canDownload?: boolean
canDownloadSource?: boolean
canShare?: boolean
canEditAssets?: boolean
}> = Array.isArray(body?.permissions) ? body.permissions : []
if (!slug) return NextResponse.json({ error: '缺少套餐' }, { status: 400 })
if (incoming.length === 0) {
@ -127,7 +128,7 @@ export async function PUT(request: NextRequest) {
canDownload: Boolean(item.canDownload),
canDownloadSource: Boolean(item.canDownloadSource),
canShare: item.canShare !== false,
canEditAssets: false,
canEditAssets: item.canEditAssets === true,
})),
)
return NextResponse.json({ ok: true })