29 lines
715 B
JavaScript
29 lines
715 B
JavaScript
import { LayoutGrid, ClipboardList, FolderKanban, Wrench, Users } from "lucide-react";
|
||
|
||
// Sidebar'da görünen ve erişim denetiminde kullanılan tek kaynak.
|
||
// roles: undefined -> herkes erişebilir. Aksi halde listelenen rollere sahip
|
||
// kullanıcılar erişebilir.
|
||
export const dashboardRoutes = [
|
||
{
|
||
href: "/",
|
||
label: "Main Page",
|
||
icon: LayoutGrid,
|
||
showInSidebar: false,
|
||
},
|
||
{
|
||
href: "/person",
|
||
label: "Users",
|
||
icon: Users,
|
||
roles: ["ADMINISTRATOR"],
|
||
},
|
||
];
|
||
|
||
export function canAccessRoute(route, role) {
|
||
if (!route.roles) return true;
|
||
return route.roles.includes(role);
|
||
}
|
||
|
||
export function findRouteByPath(path) {
|
||
return dashboardRoutes.find((r) => r.href === path);
|
||
}
|