mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +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 */
|
||||
JsonRoutes.add('get', '/api/b/:id', function (req, res) {
|
||||
const id = req.params.id;
|
||||
const exporter = new Exporter(id);
|
||||
JsonRoutes.sendResult(res, 200, exporter.build());
|
||||
if(Meteor.isServer) {
|
||||
console.log(`userId is ${this.userId}`);
|
||||
JsonRoutes.add('get', '/api/b/:id', function (req, res) {
|
||||
const id = req.params.id;
|
||||
const board = Boards.findOne(id);
|
||||
//if(Meteor.userId() && allowIsBoardMember(Meteor.userId(), board)) {
|
||||
const exporter = new Exporter(id);
|
||||
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 {
|
||||
|
|
@ -45,7 +63,7 @@ class Exporter {
|
|||
'profile.avatarUrl': 1,
|
||||
}};
|
||||
result.users = Users.find(byUserIds, userFields).fetch();
|
||||
|
||||
//return JSON.stringify(result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue