diff options
author | huneau romain <huneau.romain@gmail.com> | 2017-05-11 12:15:02 +0200 |
---|---|---|
committer | huneau romain <huneau.romain@gmail.com> | 2017-05-11 12:15:02 +0200 |
commit | b5271e5346cde2563d36c64a300729e27336a86b (patch) | |
tree | 98d29cf0deeaeb8a6d337c8dff4b8cf9268541c6 /models/boards.js | |
parent | 548172949aaaea054f203d5fdc3286c90c5ae8e1 (diff) | |
download | wekan-b5271e5346cde2563d36c64a300729e27336a86b.tar.gz wekan-b5271e5346cde2563d36c64a300729e27336a86b.tar.bz2 wekan-b5271e5346cde2563d36c64a300729e27336a86b.zip |
add token authentication, only admin can use api
Diffstat (limited to 'models/boards.js')
-rw-r--r-- | models/boards.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/models/boards.js b/models/boards.js index 9cbb5b63..879dde84 100644 --- a/models/boards.js +++ b/models/boards.js @@ -557,6 +557,7 @@ if (Meteor.isServer) { //BOARDS REST API if (Meteor.isServer) { JsonRoutes.add('GET', '/api/boards', function (req, res, next) { + Authentication.checkUserId(req.userId); JsonRoutes.sendResult(res, { code: 200, data: Boards.find({ permission: 'public' }).map(function (doc) { @@ -569,6 +570,7 @@ if (Meteor.isServer) { }); JsonRoutes.add('GET', '/api/boards/:id', function (req, res, next) { + Authentication.checkUserId( req.userId); const id = req.params.id; JsonRoutes.sendResult(res, { code: 200, @@ -577,6 +579,7 @@ if (Meteor.isServer) { }); JsonRoutes.add('POST', '/api/boards', function (req, res, next) { + Authentication.checkUserId( req.userId); const id = Boards.insert({ title: req.body.title, members: [ @@ -599,6 +602,7 @@ if (Meteor.isServer) { }); JsonRoutes.add('DELETE', '/api/boards/:id', function (req, res, next) { + Authentication.checkUserId( req.userId); const id = req.params.id; Boards.remove({ _id: id }); JsonRoutes.sendResult(res, { |