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:
@@ -17,6 +17,8 @@ export type NavItem = {
|
||||
export type NavSection = {
|
||||
title: string;
|
||||
items: NavItem[];
|
||||
/** 是否仅超级管理员可见 */
|
||||
superAdminOnly?: boolean;
|
||||
};
|
||||
|
||||
export const navSections: NavSection[] = [
|
||||
@@ -35,6 +37,7 @@ export const navSections: NavSection[] = [
|
||||
{ href: "/rbac/roles", label: "角色", icon: ShieldCheck },
|
||||
{ href: "/rbac/permissions", label: "权限菜单", icon: KeyRound },
|
||||
],
|
||||
superAdminOnly: true,
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -8,10 +8,11 @@ import { BrandLogo } from "./brand-logo";
|
||||
import { navSections, activeHref } from "./nav";
|
||||
import { useSidebar } from "./sidebar-context";
|
||||
|
||||
export function Sidebar() {
|
||||
export function Sidebar({ isSuperAdmin }: { isSuperAdmin: boolean }) {
|
||||
const pathname = usePathname();
|
||||
const active = activeHref(pathname);
|
||||
const { collapsed } = useSidebar();
|
||||
const sections = navSections.filter((s) => !s.superAdminOnly || isSuperAdmin);
|
||||
|
||||
return (
|
||||
<aside
|
||||
@@ -30,7 +31,7 @@ export function Sidebar() {
|
||||
</div>
|
||||
|
||||
<nav className="flex-1 space-y-6 overflow-y-auto px-3 py-4">
|
||||
{navSections.map((section) => (
|
||||
{sections.map((section) => (
|
||||
<div key={section.title}>
|
||||
<div className="px-3 pb-2 text-[11px] font-medium uppercase tracking-wider text-[var(--color-sidebar-muted)]">
|
||||
{section.title}
|
||||
|
||||
Reference in New Issue
Block a user