feat(auth): add better-auth core wiring for admin and db
This commit is contained in:
@@ -4,7 +4,7 @@ import { hasPermission } from "@cms/content/rbac"
|
||||
import Link from "next/link"
|
||||
import { redirect } from "next/navigation"
|
||||
|
||||
import { resolveRoleFromServerContext } from "@/lib/access"
|
||||
import { resolveRoleFromServerContext } from "@/lib/access-server"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
@@ -407,7 +407,11 @@ export default async function AdminTodoPage(props: {
|
||||
}) {
|
||||
const role = await resolveRoleFromServerContext()
|
||||
|
||||
if (!role || !hasPermission(role, "roadmap:read", "global")) {
|
||||
if (!role) {
|
||||
redirect("/login?next=/todo")
|
||||
}
|
||||
|
||||
if (!hasPermission(role, "roadmap:read", "global")) {
|
||||
redirect("/unauthorized?required=roadmap:read&scope=global")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user