用户组增加权限控制
This commit is contained in:
@@ -2,6 +2,7 @@ import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
import { getAuthInfoFromCookie } from '@/lib/auth';
|
||||
import { db } from '@/lib/db';
|
||||
import { hasFeaturePermission } from '@/lib/permissions';
|
||||
|
||||
export async function getMusicV2Username(request: NextRequest): Promise<string | null> {
|
||||
const authInfo = getAuthInfoFromCookie(request);
|
||||
@@ -14,6 +15,11 @@ export async function getMusicV2Username(request: NextRequest): Promise<string |
|
||||
}
|
||||
}
|
||||
|
||||
const allowed = await hasFeaturePermission(authInfo.username, 'music');
|
||||
if (!allowed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return authInfo.username;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user