|
@@ -294,8 +294,8 @@ if (Meteor.isServer) {
|
|
|
req,
|
|
|
res,
|
|
|
) {
|
|
|
- Authentication.checkUserId(req.userId);
|
|
|
const paramBoardId = req.params.boardId;
|
|
|
+ Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
|
JsonRoutes.sendResult(res, {
|
|
|
code: 200,
|
|
|
data: CustomFields.find({ boardIds: { $in: [paramBoardId] } }).map(
|
|
@@ -323,8 +323,8 @@ if (Meteor.isServer) {
|
|
|
'GET',
|
|
|
'/api/boards/:boardId/custom-fields/:customFieldId',
|
|
|
function(req, res) {
|
|
|
- Authentication.checkUserId(req.userId);
|
|
|
const paramBoardId = req.params.boardId;
|
|
|
+ Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
|
const paramCustomFieldId = req.params.customFieldId;
|
|
|
JsonRoutes.sendResult(res, {
|
|
|
code: 200,
|
|
@@ -353,8 +353,8 @@ if (Meteor.isServer) {
|
|
|
req,
|
|
|
res,
|
|
|
) {
|
|
|
- Authentication.checkUserId(req.userId);
|
|
|
const paramBoardId = req.params.boardId;
|
|
|
+ Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
|
const board = Boards.findOne({ _id: paramBoardId });
|
|
|
const id = CustomFields.direct.insert({
|
|
|
name: req.body.name,
|
|
@@ -396,7 +396,8 @@ if (Meteor.isServer) {
|
|
|
'PUT',
|
|
|
'/api/boards/:boardId/custom-fields/:customFieldId',
|
|
|
(req, res) => {
|
|
|
- Authentication.checkUserId(req.userId);
|
|
|
+ const paramBoardId = req.params.boardId;
|
|
|
+ Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
|
|
|
|
const paramFieldId = req.params.customFieldId;
|
|
|
|
|
@@ -461,7 +462,8 @@ if (Meteor.isServer) {
|
|
|
'POST',
|
|
|
'/api/boards/:boardId/custom-fields/:customFieldId/dropdown-items',
|
|
|
(req, res) => {
|
|
|
- Authentication.checkUserId(req.userId);
|
|
|
+ const paramBoardId = req.params.boardId;
|
|
|
+ Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
|
|
|
|
const paramCustomFieldId = req.params.customFieldId;
|
|
|
const paramItems = req.body.items;
|
|
@@ -504,7 +506,8 @@ if (Meteor.isServer) {
|
|
|
'PUT',
|
|
|
'/api/boards/:boardId/custom-fields/:customFieldId/dropdown-items/:dropdownItemId',
|
|
|
(req, res) => {
|
|
|
- Authentication.checkUserId(req.userId);
|
|
|
+ const paramBoardId = req.params.boardId;
|
|
|
+ Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
|
|
|
|
const paramDropdownItemId = req.params.dropdownItemId;
|
|
|
const paramCustomFieldId = req.params.customFieldId;
|
|
@@ -545,7 +548,8 @@ if (Meteor.isServer) {
|
|
|
'DELETE',
|
|
|
'/api/boards/:boardId/custom-fields/:customFieldId/dropdown-items/:dropdownItemId',
|
|
|
(req, res) => {
|
|
|
- Authentication.checkUserId(req.userId);
|
|
|
+ const paramBoardId = req.params.boardId;
|
|
|
+ Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
|
|
|
|
paramCustomFieldId = req.params.customFieldId;
|
|
|
paramDropdownItemId = req.params.dropdownItemId;
|
|
@@ -580,7 +584,8 @@ if (Meteor.isServer) {
|
|
|
'DELETE',
|
|
|
'/api/boards/:boardId/custom-fields/:customFieldId',
|
|
|
function(req, res) {
|
|
|
- Authentication.checkUserId(req.userId);
|
|
|
+ const paramBoardId = req.params.boardId;
|
|
|
+ Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
|
const paramBoardId = req.params.boardId;
|
|
|
const id = req.params.customFieldId;
|
|
|
CustomFields.remove({ _id: id, boardIds: { $in: [paramBoardId] } });
|