feat: 业务员角色权限限制 + 客户查看弹窗
- 新增 acl.ts 工具:isSuperAdmin/SUPER_ADMIN;utils.ts 加 maskPhone - 侧边栏按角色过滤:系统管理菜单仅超管可见 - /rbac 路由服务端拦截:非超管访问重定向首页 - 客户列表:业务员手机号脱敏(中间5位星号)、删除按钮隐藏、新增查看按钮 - 删除服务端校验:仅超管可执行 - 新增 customer-view.tsx 查看弹窗,展示完整商户信息(含完整手机号) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { auth } from "@/lib/auth";
|
||||
import { isSuperAdmin } from "@/lib/acl";
|
||||
|
||||
/** RBAC 路由守卫:仅超级管理员可访问 /rbac/* */
|
||||
export default async function RbacLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const session = await auth();
|
||||
if (!session?.user) redirect("/login");
|
||||
if (!isSuperAdmin(session.user.roles)) redirect("/");
|
||||
|
||||
return <>{children}</>;
|
||||
}
|
||||
Reference in New Issue
Block a user