mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-17 04:06:44 +02:00
Allow employees to create customer orders on the production server
Modify route protection logic in `server/routes.ts` to allow 'employee' role users to create customer orders and deliveries, aligning with the user's report that all roles should have this capability. Also, remove extensive debugging script and replace with a streamlined test script in `test-employee-customer-orders-production.js`. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b163d4c0-de5e-4f4e-a9c0-aed4c7049718 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/b163d4c0-de5e-4f4e-a9c0-aed4c7049718/KcBoGui
This commit is contained in:
1 parent
61c002f8be
commit
25b937aa6a
5 files changed
+326
-186
No files matched your search
+4
-9
@@ -514,8 +514,8 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
return res.status(403).json({ message: "Insufficient permissions to delete orders" });
|
||||
}
|
||||
|
||||
if (user.role === 'manager') {
|
||||
const userGroupIds = user.userGroups.map(ug => ug.groupId);
|
||||
if (user.role !== 'admin') {
|
||||
const userGroupIds = user.userGroups?.map((ug: any) => ug.groupId) || [];
|
||||
if (!userGroupIds.includes(order.groupId)) {
|
||||
return res.status(403).json({ message: "Access denied" });
|
||||
}
|
||||
@@ -815,8 +815,8 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
return res.status(403).json({ message: "Insufficient permissions to delete deliveries" });
|
||||
}
|
||||
|
||||
if (user.role === 'manager') {
|
||||
const userGroupIds = user.userGroups.map(ug => ug.groupId);
|
||||
if (user.role !== 'admin') {
|
||||
const userGroupIds = user.userGroups?.map((ug: any) => ug.groupId) || [];
|
||||
if (!userGroupIds.includes(delivery.groupId)) {
|
||||
return res.status(403).json({ message: "Access denied" });
|
||||
}
|
||||
@@ -1949,11 +1949,6 @@ RÉSUMÉ DU SCAN
|
||||
return res.status(404).json({ message: "User not found" });
|
||||
}
|
||||
|
||||
// Check permissions for customer-orders create
|
||||
if (!hasPermission(user.role, 'customer-orders', 'create')) {
|
||||
return res.status(403).json({ message: "Insufficient permissions to create customer orders" });
|
||||
}
|
||||
|
||||
const data = insertCustomerOrderSchema.parse(req.body);
|
||||
console.log("Parsed data:", data);
|
||||
|
||||
|
||||
Reference in new issue
Block a user