chenpei 0ce59be34e 备份:组织架构设计方案讨论前的代码快照
- 包含所有当前修改和新功能
- 准备开始组织架构优化实施方案
2025-12-30 13:20:26 +08:00

24 lines
763 B
TypeScript

import { NextRequest, NextResponse } from 'next/server';
import { getServerSession } from 'next-auth';
import { authOptions } from '@/lib/auth';
import { isSuperAdmin } from '@/lib/department-permission';
// GET - 检查当前用户是否是超级管理员
export async function GET(request: NextRequest) {
try {
const session = await getServerSession(authOptions);
const userId = (session?.user as any)?.id;
if (!session || !userId) {
return NextResponse.json({ isSuperAdmin: false });
}
const result = await isSuperAdmin(userId);
return NextResponse.json({ isSuperAdmin: result });
} catch (error) {
console.error('Check super admin error:', error);
return NextResponse.json({ isSuperAdmin: false });
}
}