replace old wares.verifyAuthorization with ctx.authorization.isPermitted; some refactoring

This commit is contained in:
Jason Calabrese
2016-07-31 20:10:10 -07:00
parent 893a7c863b
commit 3d88bd33a6
21 changed files with 216 additions and 163 deletions
+2 -2
View File
@@ -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);