mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
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:
parent
b2d938d2fc
commit
4a8cadc6ee
@ -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,
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user