feat: add setting access to change setting data

main-cloud 1.1.2-cloud.1
Firman Ramdhani 2025-05-16 10:07:20 +07:00
parent e6481aa606
commit 29ff09d3aa
1 changed files with 16 additions and 1 deletions

View File

@ -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 ( return (
<Layout> <Layout>
<Header <Header
@ -81,7 +88,15 @@ export default function AdminLayout(props: AdminLayoutProps) {
}); });
}, },
}, },
], ]
.map((item) => {
const isAllowSetting = checkAllowAccessSetting();
if (!isAllowSetting && (item.key === '1' || item.type === 'divider')) {
return undefined;
}
return item;
})
.filter(Boolean) as any,
}} }}
> >
<Avatar size={35} style={{ cursor: 'pointer' }}> <Avatar size={35} style={{ cursor: 'pointer' }}>