mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Fixed REST API, it shoud work now by Admin user.
Reverted Allow board members to use more of API of Wekan v5.35
a719e8fda1
Thanks to tomhughes.
Fixes #4009,
fixes #2793,
fixes #2790
This commit is contained in:
parent
5b5094ced6
commit
e3a0dea85f
8 changed files with 38 additions and 45 deletions
|
@ -1831,8 +1831,7 @@ if (Meteor.isServer) {
|
||||||
*/
|
*/
|
||||||
JsonRoutes.add('GET', '/api/boards', function(req, res) {
|
JsonRoutes.add('GET', '/api/boards', function(req, res) {
|
||||||
try {
|
try {
|
||||||
const paramBoardId = req.params.boardId;
|
Authentication.checkUserId(req.userId);
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
data: Boards.find(
|
data: Boards.find(
|
||||||
|
@ -1888,8 +1887,8 @@ if (Meteor.isServer) {
|
||||||
*/
|
*/
|
||||||
JsonRoutes.add('GET', '/api/boards/:boardId', function(req, res) {
|
JsonRoutes.add('GET', '/api/boards/:boardId', function(req, res) {
|
||||||
try {
|
try {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const id = req.params.boardId;
|
const id = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, id);
|
|
||||||
|
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
|
@ -2006,8 +2005,7 @@ if (Meteor.isServer) {
|
||||||
* @return_type string
|
* @return_type string
|
||||||
*/
|
*/
|
||||||
JsonRoutes.add('PUT', '/api/boards/:boardId/labels', function(req, res) {
|
JsonRoutes.add('PUT', '/api/boards/:boardId/labels', function(req, res) {
|
||||||
const paramBoardId = req.params.boardId;
|
Authentication.checkUserId(req.userId);
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const id = req.params.boardId;
|
const id = req.params.boardId;
|
||||||
try {
|
try {
|
||||||
if (req.body.hasOwnProperty('label')) {
|
if (req.body.hasOwnProperty('label')) {
|
||||||
|
@ -2054,10 +2052,10 @@ if (Meteor.isServer) {
|
||||||
res,
|
res,
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const boardId = req.params.boardId;
|
const boardId = req.params.boardId;
|
||||||
const memberId = req.params.memberId;
|
const memberId = req.params.memberId;
|
||||||
const { isAdmin, isNoComments, isCommentOnly, isWorker } = req.body;
|
const { isAdmin, isNoComments, isCommentOnly, isWorker } = req.body;
|
||||||
Authentication.checkBoardAccess(req.userId, boardId);
|
|
||||||
const board = Boards.findOne({ _id: boardId });
|
const board = Boards.findOne({ _id: boardId });
|
||||||
function isTrue(data) {
|
function isTrue(data) {
|
||||||
try {
|
try {
|
||||||
|
@ -2101,8 +2099,8 @@ if (Meteor.isServer) {
|
||||||
* swimlaneId: string}]
|
* swimlaneId: string}]
|
||||||
*/
|
*/
|
||||||
JsonRoutes.add('GET', '/api/boards/:boardId/attachments', function(req, res) {
|
JsonRoutes.add('GET', '/api/boards/:boardId/attachments', function(req, res) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
data: Attachments.files
|
data: Attachments.files
|
||||||
|
|
|
@ -234,8 +234,8 @@ if (Meteor.isServer) {
|
||||||
res,
|
res,
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const paramCardId = req.params.cardId;
|
const paramCardId = req.params.cardId;
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
|
@ -272,8 +272,8 @@ if (Meteor.isServer) {
|
||||||
'/api/boards/:boardId/cards/:cardId/comments/:commentId',
|
'/api/boards/:boardId/cards/:cardId/comments/:commentId',
|
||||||
function (req, res) {
|
function (req, res) {
|
||||||
try {
|
try {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const paramCommentId = req.params.commentId;
|
const paramCommentId = req.params.commentId;
|
||||||
const paramCardId = req.params.cardId;
|
const paramCardId = req.params.cardId;
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
|
@ -308,8 +308,8 @@ if (Meteor.isServer) {
|
||||||
'/api/boards/:boardId/cards/:cardId/comments',
|
'/api/boards/:boardId/cards/:cardId/comments',
|
||||||
function (req, res) {
|
function (req, res) {
|
||||||
try {
|
try {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const paramCardId = req.params.cardId;
|
const paramCardId = req.params.cardId;
|
||||||
const id = CardComments.direct.insert({
|
const id = CardComments.direct.insert({
|
||||||
userId: req.body.authorId,
|
userId: req.body.authorId,
|
||||||
|
@ -354,8 +354,8 @@ if (Meteor.isServer) {
|
||||||
'/api/boards/:boardId/cards/:cardId/comments/:commentId',
|
'/api/boards/:boardId/cards/:cardId/comments/:commentId',
|
||||||
function (req, res) {
|
function (req, res) {
|
||||||
try {
|
try {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const paramCommentId = req.params.commentId;
|
const paramCommentId = req.params.commentId;
|
||||||
const paramCardId = req.params.cardId;
|
const paramCardId = req.params.cardId;
|
||||||
CardComments.remove({
|
CardComments.remove({
|
||||||
|
|
|
@ -3110,9 +3110,9 @@ if (Meteor.isServer) {
|
||||||
'GET',
|
'GET',
|
||||||
'/api/boards/:boardId/swimlanes/:swimlaneId/cards',
|
'/api/boards/:boardId/swimlanes/:swimlaneId/cards',
|
||||||
function(req, res) {
|
function(req, res) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
const paramSwimlaneId = req.params.swimlaneId;
|
const paramSwimlaneId = req.params.swimlaneId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
data: Cards.find({
|
data: Cards.find({
|
||||||
|
@ -3152,9 +3152,9 @@ if (Meteor.isServer) {
|
||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
) {
|
) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
const paramListId = req.params.listId;
|
const paramListId = req.params.listId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
data: Cards.find({
|
data: Cards.find({
|
||||||
|
@ -3189,10 +3189,10 @@ if (Meteor.isServer) {
|
||||||
'GET',
|
'GET',
|
||||||
'/api/boards/:boardId/lists/:listId/cards/:cardId',
|
'/api/boards/:boardId/lists/:listId/cards/:cardId',
|
||||||
function(req, res) {
|
function(req, res) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
const paramListId = req.params.listId;
|
const paramListId = req.params.listId;
|
||||||
const paramCardId = req.params.cardId;
|
const paramCardId = req.params.cardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
data: Cards.findOne({
|
data: Cards.findOne({
|
||||||
|
@ -3339,8 +3339,8 @@ if (Meteor.isServer) {
|
||||||
'PUT',
|
'PUT',
|
||||||
'/api/boards/:boardId/lists/:listId/cards/:cardId',
|
'/api/boards/:boardId/lists/:listId/cards/:cardId',
|
||||||
function(req, res) {
|
function(req, res) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const paramCardId = req.params.cardId;
|
const paramCardId = req.params.cardId;
|
||||||
const paramListId = req.params.listId;
|
const paramListId = req.params.listId;
|
||||||
|
|
||||||
|
@ -3697,8 +3697,8 @@ if (Meteor.isServer) {
|
||||||
'DELETE',
|
'DELETE',
|
||||||
'/api/boards/:boardId/lists/:listId/cards/:cardId',
|
'/api/boards/:boardId/lists/:listId/cards/:cardId',
|
||||||
function(req, res) {
|
function(req, res) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const paramListId = req.params.listId;
|
const paramListId = req.params.listId;
|
||||||
const paramCardId = req.params.cardId;
|
const paramCardId = req.params.cardId;
|
||||||
|
|
||||||
|
@ -3737,11 +3737,10 @@ if (Meteor.isServer) {
|
||||||
'GET',
|
'GET',
|
||||||
'/api/boards/:boardId/cardsByCustomField/:customFieldId/:customFieldValue',
|
'/api/boards/:boardId/cardsByCustomField/:customFieldId/:customFieldValue',
|
||||||
function(req, res) {
|
function(req, res) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
const paramCustomFieldId = req.params.customFieldId;
|
const paramCustomFieldId = req.params.customFieldId;
|
||||||
const paramCustomFieldValue = req.params.customFieldValue;
|
const paramCustomFieldValue = req.params.customFieldValue;
|
||||||
|
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
data: Cards.find({
|
data: Cards.find({
|
||||||
|
|
|
@ -265,8 +265,8 @@ if (Meteor.isServer) {
|
||||||
'GET',
|
'GET',
|
||||||
'/api/boards/:boardId/cards/:cardId/checklists/:checklistId/items/:itemId',
|
'/api/boards/:boardId/cards/:cardId/checklists/:checklistId/items/:itemId',
|
||||||
function(req, res) {
|
function(req, res) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const paramItemId = req.params.itemId;
|
const paramItemId = req.params.itemId;
|
||||||
const checklistItem = ChecklistItems.findOne({ _id: paramItemId });
|
const checklistItem = ChecklistItems.findOne({ _id: paramItemId });
|
||||||
if (checklistItem) {
|
if (checklistItem) {
|
||||||
|
@ -299,9 +299,8 @@ if (Meteor.isServer) {
|
||||||
'PUT',
|
'PUT',
|
||||||
'/api/boards/:boardId/cards/:cardId/checklists/:checklistId/items/:itemId',
|
'/api/boards/:boardId/cards/:cardId/checklists/:checklistId/items/:itemId',
|
||||||
function(req, res) {
|
function(req, res) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
|
|
||||||
const paramItemId = req.params.itemId;
|
const paramItemId = req.params.itemId;
|
||||||
|
|
||||||
function isTrue(data) {
|
function isTrue(data) {
|
||||||
|
@ -351,8 +350,8 @@ if (Meteor.isServer) {
|
||||||
'DELETE',
|
'DELETE',
|
||||||
'/api/boards/:boardId/cards/:cardId/checklists/:checklistId/items/:itemId',
|
'/api/boards/:boardId/cards/:cardId/checklists/:checklistId/items/:itemId',
|
||||||
function(req, res) {
|
function(req, res) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const paramItemId = req.params.itemId;
|
const paramItemId = req.params.itemId;
|
||||||
ChecklistItems.direct.remove({ _id: paramItemId });
|
ChecklistItems.direct.remove({ _id: paramItemId });
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
|
|
|
@ -204,8 +204,8 @@ if (Meteor.isServer) {
|
||||||
'GET',
|
'GET',
|
||||||
'/api/boards/:boardId/cards/:cardId/checklists',
|
'/api/boards/:boardId/cards/:cardId/checklists',
|
||||||
function(req, res) {
|
function(req, res) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const paramCardId = req.params.cardId;
|
const paramCardId = req.params.cardId;
|
||||||
const checklists = Checklists.find({ cardId: paramCardId }).map(function(
|
const checklists = Checklists.find({ cardId: paramCardId }).map(function(
|
||||||
doc,
|
doc,
|
||||||
|
@ -248,8 +248,8 @@ if (Meteor.isServer) {
|
||||||
'GET',
|
'GET',
|
||||||
'/api/boards/:boardId/cards/:cardId/checklists/:checklistId',
|
'/api/boards/:boardId/cards/:cardId/checklists/:checklistId',
|
||||||
function(req, res) {
|
function(req, res) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const paramChecklistId = req.params.checklistId;
|
const paramChecklistId = req.params.checklistId;
|
||||||
const paramCardId = req.params.cardId;
|
const paramCardId = req.params.cardId;
|
||||||
const checklist = Checklists.findOne({
|
const checklist = Checklists.findOne({
|
||||||
|
@ -292,8 +292,9 @@ if (Meteor.isServer) {
|
||||||
'POST',
|
'POST',
|
||||||
'/api/boards/:boardId/cards/:cardId/checklists',
|
'/api/boards/:boardId/cards/:cardId/checklists',
|
||||||
function(req, res) {
|
function(req, res) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
// Check user is logged in
|
// Check user is logged in
|
||||||
Authentication.checkLoggedIn(req.userId);
|
//Authentication.checkLoggedIn(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
// Check user has permission to add checklist to the card
|
// Check user has permission to add checklist to the card
|
||||||
const board = Boards.findOne({
|
const board = Boards.findOne({
|
||||||
|
@ -353,8 +354,8 @@ if (Meteor.isServer) {
|
||||||
'DELETE',
|
'DELETE',
|
||||||
'/api/boards/:boardId/cards/:cardId/checklists/:checklistId',
|
'/api/boards/:boardId/cards/:cardId/checklists/:checklistId',
|
||||||
function(req, res) {
|
function(req, res) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const paramChecklistId = req.params.checklistId;
|
const paramChecklistId = req.params.checklistId;
|
||||||
Checklists.remove({ _id: paramChecklistId });
|
Checklists.remove({ _id: paramChecklistId });
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
|
|
|
@ -301,8 +301,8 @@ if (Meteor.isServer) {
|
||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
) {
|
) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
data: CustomFields.find({ boardIds: { $in: [paramBoardId] } }).map(
|
data: CustomFields.find({ boardIds: { $in: [paramBoardId] } }).map(
|
||||||
|
@ -330,8 +330,8 @@ if (Meteor.isServer) {
|
||||||
'GET',
|
'GET',
|
||||||
'/api/boards/:boardId/custom-fields/:customFieldId',
|
'/api/boards/:boardId/custom-fields/:customFieldId',
|
||||||
function(req, res) {
|
function(req, res) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const paramCustomFieldId = req.params.customFieldId;
|
const paramCustomFieldId = req.params.customFieldId;
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
|
@ -361,8 +361,8 @@ if (Meteor.isServer) {
|
||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
) {
|
) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const board = Boards.findOne({ _id: paramBoardId });
|
const board = Boards.findOne({ _id: paramBoardId });
|
||||||
const id = CustomFields.direct.insert({
|
const id = CustomFields.direct.insert({
|
||||||
name: req.body.name,
|
name: req.body.name,
|
||||||
|
@ -406,9 +406,8 @@ if (Meteor.isServer) {
|
||||||
'PUT',
|
'PUT',
|
||||||
'/api/boards/:boardId/custom-fields/:customFieldId',
|
'/api/boards/:boardId/custom-fields/:customFieldId',
|
||||||
(req, res) => {
|
(req, res) => {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
|
|
||||||
const paramFieldId = req.params.customFieldId;
|
const paramFieldId = req.params.customFieldId;
|
||||||
|
|
||||||
if (req.body.hasOwnProperty('name')) {
|
if (req.body.hasOwnProperty('name')) {
|
||||||
|
@ -480,9 +479,8 @@ if (Meteor.isServer) {
|
||||||
'POST',
|
'POST',
|
||||||
'/api/boards/:boardId/custom-fields/:customFieldId/dropdown-items',
|
'/api/boards/:boardId/custom-fields/:customFieldId/dropdown-items',
|
||||||
(req, res) => {
|
(req, res) => {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
|
|
||||||
const paramCustomFieldId = req.params.customFieldId;
|
const paramCustomFieldId = req.params.customFieldId;
|
||||||
const paramItems = req.body.items;
|
const paramItems = req.body.items;
|
||||||
|
|
||||||
|
@ -524,9 +522,8 @@ if (Meteor.isServer) {
|
||||||
'PUT',
|
'PUT',
|
||||||
'/api/boards/:boardId/custom-fields/:customFieldId/dropdown-items/:dropdownItemId',
|
'/api/boards/:boardId/custom-fields/:customFieldId/dropdown-items/:dropdownItemId',
|
||||||
(req, res) => {
|
(req, res) => {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
|
|
||||||
const paramDropdownItemId = req.params.dropdownItemId;
|
const paramDropdownItemId = req.params.dropdownItemId;
|
||||||
const paramCustomFieldId = req.params.customFieldId;
|
const paramCustomFieldId = req.params.customFieldId;
|
||||||
const paramName = req.body.name;
|
const paramName = req.body.name;
|
||||||
|
@ -566,9 +563,8 @@ if (Meteor.isServer) {
|
||||||
'DELETE',
|
'DELETE',
|
||||||
'/api/boards/:boardId/custom-fields/:customFieldId/dropdown-items/:dropdownItemId',
|
'/api/boards/:boardId/custom-fields/:customFieldId/dropdown-items/:dropdownItemId',
|
||||||
(req, res) => {
|
(req, res) => {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
|
|
||||||
paramCustomFieldId = req.params.customFieldId;
|
paramCustomFieldId = req.params.customFieldId;
|
||||||
paramDropdownItemId = req.params.dropdownItemId;
|
paramDropdownItemId = req.params.dropdownItemId;
|
||||||
|
|
||||||
|
@ -602,8 +598,8 @@ if (Meteor.isServer) {
|
||||||
'DELETE',
|
'DELETE',
|
||||||
'/api/boards/:boardId/custom-fields/:customFieldId',
|
'/api/boards/:boardId/custom-fields/:customFieldId',
|
||||||
function(req, res) {
|
function(req, res) {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const id = req.params.customFieldId;
|
const id = req.params.customFieldId;
|
||||||
CustomFields.remove({ _id: id, boardIds: { $in: [paramBoardId] } });
|
CustomFields.remove({ _id: id, boardIds: { $in: [paramBoardId] } });
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
|
|
|
@ -467,8 +467,8 @@ if (Meteor.isServer) {
|
||||||
*/
|
*/
|
||||||
JsonRoutes.add('GET', '/api/boards/:boardId/lists', function(req, res) {
|
JsonRoutes.add('GET', '/api/boards/:boardId/lists', function(req, res) {
|
||||||
try {
|
try {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
|
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
|
@ -502,9 +502,9 @@ if (Meteor.isServer) {
|
||||||
res,
|
res,
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
const paramListId = req.params.listId;
|
const paramListId = req.params.listId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
data: Lists.findOne({
|
data: Lists.findOne({
|
||||||
|
@ -531,8 +531,8 @@ if (Meteor.isServer) {
|
||||||
*/
|
*/
|
||||||
JsonRoutes.add('POST', '/api/boards/:boardId/lists', function(req, res) {
|
JsonRoutes.add('POST', '/api/boards/:boardId/lists', function(req, res) {
|
||||||
try {
|
try {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const board = Boards.findOne(paramBoardId);
|
const board = Boards.findOne(paramBoardId);
|
||||||
const id = Lists.insert({
|
const id = Lists.insert({
|
||||||
title: req.body.title,
|
title: req.body.title,
|
||||||
|
@ -569,8 +569,8 @@ if (Meteor.isServer) {
|
||||||
res,
|
res,
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const paramListId = req.params.listId;
|
const paramListId = req.params.listId;
|
||||||
Lists.remove({ _id: paramListId, boardId: paramBoardId });
|
Lists.remove({ _id: paramListId, boardId: paramBoardId });
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
|
|
|
@ -388,8 +388,8 @@ if (Meteor.isServer) {
|
||||||
*/
|
*/
|
||||||
JsonRoutes.add('GET', '/api/boards/:boardId/swimlanes', function(req, res) {
|
JsonRoutes.add('GET', '/api/boards/:boardId/swimlanes', function(req, res) {
|
||||||
try {
|
try {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
|
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
|
@ -424,9 +424,9 @@ if (Meteor.isServer) {
|
||||||
res,
|
res,
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
const paramSwimlaneId = req.params.swimlaneId;
|
const paramSwimlaneId = req.params.swimlaneId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
data: Swimlanes.findOne({
|
data: Swimlanes.findOne({
|
||||||
|
@ -454,8 +454,8 @@ if (Meteor.isServer) {
|
||||||
*/
|
*/
|
||||||
JsonRoutes.add('POST', '/api/boards/:boardId/swimlanes', function(req, res) {
|
JsonRoutes.add('POST', '/api/boards/:boardId/swimlanes', function(req, res) {
|
||||||
try {
|
try {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
|
||||||
const board = Boards.findOne(paramBoardId);
|
const board = Boards.findOne(paramBoardId);
|
||||||
const id = Swimlanes.insert({
|
const id = Swimlanes.insert({
|
||||||
title: req.body.title,
|
title: req.body.title,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue