mirror of
https://github.com/wekan/wekan.git
synced 2025-12-20 01:10:12 +01:00
export works but no authentication
This commit is contained in:
parent
f20b5d04f5
commit
7cfc72da99
1 changed files with 23 additions and 5 deletions
|
|
@ -1,8 +1,26 @@
|
||||||
/* global JsonRoutes */
|
/* global JsonRoutes */
|
||||||
|
if(Meteor.isServer) {
|
||||||
|
console.log(`userId is ${this.userId}`);
|
||||||
JsonRoutes.add('get', '/api/b/:id', function (req, res) {
|
JsonRoutes.add('get', '/api/b/:id', function (req, res) {
|
||||||
const id = req.params.id;
|
const id = req.params.id;
|
||||||
|
const board = Boards.findOne(id);
|
||||||
|
//if(Meteor.userId() && allowIsBoardMember(Meteor.userId(), board)) {
|
||||||
const exporter = new Exporter(id);
|
const exporter = new Exporter(id);
|
||||||
JsonRoutes.sendResult(res, 200, exporter.build());
|
JsonRoutes.sendResult(res, 200, exporter.build());
|
||||||
|
//} else {
|
||||||
|
// // 403 = forbidden
|
||||||
|
// JsonRoutes.sendError(res, 403);
|
||||||
|
//}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Meteor.methods({
|
||||||
|
exportBoard(boardId) {
|
||||||
|
const board = Boards.findOne(boardId);
|
||||||
|
// //if(Meteor.userId() && allowIsBoardMember(Meteor.userId(), board)) {
|
||||||
|
const exporter = new Exporter(boardId);
|
||||||
|
return exporter.build();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
class Exporter {
|
class Exporter {
|
||||||
|
|
@ -45,7 +63,7 @@ class Exporter {
|
||||||
'profile.avatarUrl': 1,
|
'profile.avatarUrl': 1,
|
||||||
}};
|
}};
|
||||||
result.users = Users.find(byUserIds, userFields).fetch();
|
result.users = Users.find(byUserIds, userFields).fetch();
|
||||||
|
//return JSON.stringify(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue