mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-22 14:38:19 +02:00
Grant task creation permissions to managers
Update shared/permissions.ts to add 'create' permission to manager role for tasks module. Also, add a permission check in server/routes.ts before creating a task. Replit-Commit-Author: Agent Replit-Commit-Session-Id: f2b9c241-9fdd-4abd-9041-720afc8b27d6 Replit-Commit-Checkpoint-Type: full_checkpoint
This commit is contained in:
1 parent
6db69c8c94
commit
989b2c8c40
2 files changed
+7
-2
No files matched your search
@@ -1645,6 +1645,11 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
return res.status(404).json({ message: "User not found" });
|
return res.status(404).json({ message: "User not found" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check permissions for creating tasks
|
||||||
|
if (!hasPermission(user.role, 'tasks', 'create')) {
|
||||||
|
return res.status(403).json({ message: "Permission denied: cannot create tasks" });
|
||||||
|
}
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
...req.body,
|
...req.body,
|
||||||
createdBy: user.id,
|
createdBy: user.id,
|
||||||
|
|||||||
@@ -80,11 +80,11 @@ const PERMISSIONS: Record<Module, Record<Role, Permission[]>> = {
|
|||||||
employee: ['view', 'create']
|
employee: ['view', 'create']
|
||||||
},
|
},
|
||||||
|
|
||||||
// Tâches - Admin/Directeur tout, Manager view + validate, Employé view seulement
|
// Tâches - Admin/Directeur tout, Manager view + create + edit + validate, Employé view seulement
|
||||||
tasks: {
|
tasks: {
|
||||||
admin: ['view', 'create', 'edit', 'delete', 'validate'],
|
admin: ['view', 'create', 'edit', 'delete', 'validate'],
|
||||||
directeur: ['view', 'create', 'edit', 'delete', 'validate'],
|
directeur: ['view', 'create', 'edit', 'delete', 'validate'],
|
||||||
manager: ['view', 'validate'],
|
manager: ['view', 'create', 'edit', 'validate'],
|
||||||
employee: ['view']
|
employee: ['view']
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user