Add permission definitions to route handlers
This update introduces explicit permission definitions for various route handlers across multiple routes. These changes enhance clarity and allow for more granular control over route access based on defined permissions. The updates ensure better manageability and scalability of endpoint permissions.
This commit is contained in:
@@ -54,7 +54,11 @@ class ordersRoute
|
||||
// Return an error
|
||||
$response->error('Invalid session', 400);
|
||||
}
|
||||
});
|
||||
},
|
||||
[
|
||||
'list_orders' => 'List all orders'
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->post('/orders', function () {
|
||||
@@ -100,7 +104,11 @@ class ordersRoute
|
||||
// Return an error
|
||||
$response->error('Invalid session', 400);
|
||||
}
|
||||
});
|
||||
},
|
||||
[
|
||||
'add_order' => 'Add an order'
|
||||
]
|
||||
);
|
||||
|
||||
$this->put('/orders', function () {
|
||||
// Require the user to be logged in
|
||||
@@ -152,7 +160,11 @@ class ordersRoute
|
||||
// Return an error
|
||||
$response->error('Invalid session', 400);
|
||||
}
|
||||
});
|
||||
},
|
||||
[
|
||||
'edit_order' => 'Edit an order'
|
||||
]
|
||||
);
|
||||
|
||||
$this->delete('/orders', function () {
|
||||
// Require the user to be logged in
|
||||
@@ -186,7 +198,11 @@ class ordersRoute
|
||||
// Return an error
|
||||
$response->error('Invalid session', 400);
|
||||
}
|
||||
});
|
||||
},
|
||||
[
|
||||
'delete_order' => 'Delete an order'
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user