From 29ff09d3aa76a458c30c0f16c256376f4989786d Mon Sep 17 00:00:00 2001 From: Firman Ramdhani Date: Fri, 16 May 2025 10:07:20 +0700 Subject: [PATCH] feat: add setting access to change setting data --- src/apps/admin/layout/index.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/apps/admin/layout/index.tsx b/src/apps/admin/layout/index.tsx index b084785..81b81cb 100644 --- a/src/apps/admin/layout/index.tsx +++ b/src/apps/admin/layout/index.tsx @@ -33,6 +33,13 @@ export default function AdminLayout(props: AdminLayoutProps) { } } + function checkAllowAccessSetting() { + const username = user?.username; + const allowList = ['Endy', 'superadmin']; + if (allowList.includes(username)) return true; + return false; + } + return (
{ + const isAllowSetting = checkAllowAccessSetting(); + if (!isAllowSetting && (item.key === '1' || item.type === 'divider')) { + return undefined; + } + return item; + }) + .filter(Boolean) as any, }} >