Update schedule access control to restrict access to owners only

- Modified the `isEnabled` function in the side menu to check if the user has the "owner" role in addition to the non-cloud environment condition.
- Updated the server-side props validation in the schedules page to redirect users who are not owners, enhancing security and access control.
This commit is contained in:
Mauricio Siu 2025-05-03 09:42:28 -06:00
parent b2d938d2fc
commit 4a8cadc6ee
2 changed files with 2 additions and 2 deletions

View File

@ -165,7 +165,7 @@ const MENU: Menu = {
url: "/dashboard/schedules", url: "/dashboard/schedules",
icon: Clock, icon: Clock,
// Only enabled in non-cloud environments // Only enabled in non-cloud environments
isEnabled: ({ isCloud }) => !isCloud, isEnabled: ({ isCloud, auth }) => !isCloud && auth?.role === "owner",
}, },
{ {
isSingle: true, isSingle: true,

View File

@ -39,7 +39,7 @@ export async function getServerSideProps(
}; };
} }
const { user } = await validateRequest(ctx.req); const { user } = await validateRequest(ctx.req);
if (!user) { if (!user || user.role !== "owner") {
return { return {
redirect: { redirect: {
permanent: true, permanent: true,