mirror of
https://github.com/wekan/wekan.git
synced 2026-01-25 10:46:09 +01:00
Merge pull request #2118 from bentiss/export
Allow to call export from the API
This commit is contained in:
commit
6fbadbe5bc
1 changed files with 5 additions and 3 deletions
|
|
@ -10,7 +10,7 @@ if (Meteor.isServer) {
|
||||||
* @operation export
|
* @operation export
|
||||||
* @tag Boards
|
* @tag Boards
|
||||||
*
|
*
|
||||||
* @summary This route is used to export the board **FROM THE APPLICATION**.
|
* @summary This route is used to export the board.
|
||||||
*
|
*
|
||||||
* @description If user is already logged-in, pass loginToken as param
|
* @description If user is already logged-in, pass loginToken as param
|
||||||
* "authToken": '/api/boards/:boardId/export?authToken=:token'
|
* "authToken": '/api/boards/:boardId/export?authToken=:token'
|
||||||
|
|
@ -24,14 +24,16 @@ if (Meteor.isServer) {
|
||||||
JsonRoutes.add('get', '/api/boards/:boardId/export', function(req, res) {
|
JsonRoutes.add('get', '/api/boards/:boardId/export', function(req, res) {
|
||||||
const boardId = req.params.boardId;
|
const boardId = req.params.boardId;
|
||||||
let user = null;
|
let user = null;
|
||||||
// todo XXX for real API, first look for token in Authentication: header
|
|
||||||
// then fallback to parameter
|
|
||||||
const loginToken = req.query.authToken;
|
const loginToken = req.query.authToken;
|
||||||
if (loginToken) {
|
if (loginToken) {
|
||||||
const hashToken = Accounts._hashLoginToken(loginToken);
|
const hashToken = Accounts._hashLoginToken(loginToken);
|
||||||
user = Meteor.users.findOne({
|
user = Meteor.users.findOne({
|
||||||
'services.resume.loginTokens.hashedToken': hashToken,
|
'services.resume.loginTokens.hashedToken': hashToken,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
Authentication.checkUserId(req.userId);
|
||||||
|
user = Users.findOne({ _id: req.userId, isAdmin: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
const exporter = new Exporter(boardId);
|
const exporter = new Exporter(boardId);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue