mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
replace old wares.verifyAuthorization with ctx.authorization.isPermitted; some refactoring
This commit is contained in:
@@ -588,7 +588,7 @@ curl -s -g 'http://localhost:1337/api/v1/times/20{14..15}/T{13..18}:{00..15}'.js
|
||||
* Stores incoming payload that follows basic rules about having a
|
||||
* `type` field in `entries` storage layer.
|
||||
*/
|
||||
api.post('/entries/', wares.verifyAuthorization, function (req, res, next) {
|
||||
api.post('/entries/', ctx.authorization.isPermitted('api:entries:create'), function (req, res, next) {
|
||||
// setting this flag tells insert_entries to store the results
|
||||
req.persist_entries = true;
|
||||
next( );
|
||||
@@ -600,7 +600,7 @@ curl -s -g 'http://localhost:1337/api/v1/times/20{14..15}/T{13..18}:{00..15}'.js
|
||||
* Delete entries. The query logic works the same way as find/list. This
|
||||
* endpoint uses same search logic to remove records from the database.
|
||||
*/
|
||||
api.delete('/entries/:spec', wares.verifyAuthorization, function (req, res, next) {
|
||||
api.delete('/entries/:spec', ctx.authorization.isPermitted('api:entries:delete'), function (req, res, next) {
|
||||
// if ID, prepare to query for one record
|
||||
if (isId(req.params.spec)) {
|
||||
prepReqModel(req, req.params.model);
|
||||
|
||||
Reference in New Issue
Block a user