mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-04 05:25:22 +02:00
refactor(sidebar): clean up unused types and improve menu structure
- Removed legacy comments and unused type definitions from the sidebar component for better clarity. - Added role information to user queries in the user router to enhance permission handling. - Introduced a new schedule access permission in the RBAC schema and updated role permissions accordingly. - Enhanced error messages in role management functions for improved user feedback.
This commit is contained in:
@@ -52,6 +52,12 @@ export const PERMISSIONS = {
|
||||
description: "Access API",
|
||||
},
|
||||
},
|
||||
SCHEDULES: {
|
||||
ACCESS: {
|
||||
name: "schedules:access",
|
||||
description: "Access schedules",
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const ownerPermissions = [
|
||||
@@ -62,6 +68,7 @@ export const ownerPermissions = [
|
||||
PERMISSIONS.SERVICE.CREATE,
|
||||
PERMISSIONS.SERVICE.DELETE,
|
||||
PERMISSIONS.TRAEFIK.ACCESS,
|
||||
PERMISSIONS.SCHEDULES.ACCESS,
|
||||
] as const;
|
||||
|
||||
export const adminPermissions = [
|
||||
@@ -74,6 +81,7 @@ export const adminPermissions = [
|
||||
PERMISSIONS.TRAEFIK.ACCESS,
|
||||
PERMISSIONS.DOCKER.VIEW,
|
||||
PERMISSIONS.API.ACCESS,
|
||||
PERMISSIONS.SCHEDULES.ACCESS,
|
||||
] as const;
|
||||
|
||||
export const memberPermissions = [
|
||||
|
||||
@@ -59,7 +59,7 @@ export const removeRoleById = async (roleId: string) => {
|
||||
});
|
||||
|
||||
if (members.length > 0) {
|
||||
throw new Error("Cannot delete role with members");
|
||||
throw new Error("Cannot delete role with assigned members");
|
||||
}
|
||||
|
||||
await db.delete(role).where(eq(role.roleId, roleId));
|
||||
@@ -77,6 +77,10 @@ export const updateRoleById = async (
|
||||
throw new Error("Role not found");
|
||||
}
|
||||
|
||||
if (currentRole.isSystem) {
|
||||
throw new Error("Cannot update system role");
|
||||
}
|
||||
|
||||
await db.update(role).set(input).where(eq(role.roleId, roleId));
|
||||
|
||||
return currentRole;
|
||||
|
||||
Reference in New Issue
Block a user