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:
Mauricio Siu
2025-07-12 23:45:06 -06:00
parent 509d95fbf2
commit d78e634cb0
4 changed files with 15 additions and 70 deletions

View File

@@ -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 = [

View File

@@ -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;