소스 검색

Implemented the change of /api/user/boards as proposed by huneau

mayjs 8 년 전
부모
커밋
058aabff68
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      models/boards.js

+ 5 - 1
models/boards.js

@@ -556,8 +556,12 @@ if (Meteor.isServer) {
 
 //BOARDS REST API
 if (Meteor.isServer) {
-  JsonRoutes.add('GET', '/api/user/boards', function (req, res, next) {
+  JsonRoutes.add('GET', '/api/user/:userId/boards', function (req, res, next) {
     Authentication.checkLoggedIn(req.userId);
+    const paramUserId = req.params.userId;
+    // A normal user should be able to see their own boards,
+    // admins can access boards of any user
+    Authentication.checkAdminOrCondition(req.userId, req.userId === paramUserId);
 
     const data = Boards.find({
       archived: false,