Admin: corregir columnas de account_access + enlace al panel en la cuenta
- Este build de AzerothCore usa account_access(AccountID, SecurityLevel), no el clásico (id, gmlevel). Se corrigen las 4 consultas (admin.ts, forum-perm.ts, forum.ts, admin-users.ts) -> isAdmin/forumIsModerator/gmlevel ahora funcionan. - account page: enlace destacado al Panel de administración, visible solo si isAdmin. - i18n es/en: Account.adminPanel. Verificado: build OK; cuenta de prueba con SecurityLevel 3 (>= ADMIN_GMLEVEL) es admin. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import { getTranslations, setRequestLocale } from 'next-intl/server'
|
||||
import { redirect, Link } from '@/i18n/navigation'
|
||||
import { getSession } from '@/lib/session'
|
||||
import { getAccountDashboard } from '@/lib/account'
|
||||
import { isAdmin } from '@/lib/admin'
|
||||
import { LogoutButton } from '@/components/LogoutButton'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
@@ -16,6 +17,7 @@ export default async function AccountPage({ params }: { params: Promise<{ locale
|
||||
if (!session.username) redirect({ href: '/select-account', locale })
|
||||
|
||||
const data = await getAccountDashboard(session)
|
||||
const admin = await isAdmin(session)
|
||||
|
||||
const card = 'nw-card'
|
||||
|
||||
@@ -26,6 +28,16 @@ export default async function AccountPage({ params }: { params: Promise<{ locale
|
||||
<LogoutButton className="rounded border border-amber-900/60 px-3 py-1 text-sm text-amber-200 hover:text-amber-400" />
|
||||
</div>
|
||||
|
||||
{admin && (
|
||||
<Link
|
||||
href="/admin"
|
||||
className="mb-6 flex items-center justify-between gap-3 rounded-lg border border-nw-gold/50 bg-nw-gold/10 px-4 py-3 text-sm font-semibold text-nw-gold-light transition hover:bg-nw-gold/20"
|
||||
>
|
||||
<span>🛡️ {t('adminPanel')}</span>
|
||||
<span aria-hidden>→</span>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
<div className="grid gap-4 sm:grid-cols-2">
|
||||
<section className={card}>
|
||||
<div className="space-y-1 text-sm">
|
||||
|
||||
Reference in New Issue
Block a user