import { NextResponse } from 'next/server' import { getServerSession } from 'next-auth' import { authOptions } from '@/lib/auth' import { isSystemAdmin } from '@/lib/department-permission' // 给还在使用旧页面的管理员返回配置位置,旧字段保留供回滚兼容。 export async function POST() { const session = await getServerSession(authOptions) if (!session?.user?.id) return NextResponse.json({ error: '请先登录' }, { status: 401 }) if (!isSystemAdmin(session.user.role)) return NextResponse.json({ error: '只有系统管理员可以管理下载权限' }, { status: 403 }) return NextResponse.json({ error: '请在「权限管理」中按素材类型配置下载权限' }, { status: 410 }) }