@tiledesk/tiledesk-server 2.10.4 → 2.10.5
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/routes/faq_kb.js +10 -17
- package/routes/images.js +2 -2
- package/services/fileGridFsService.js +2 -2
package/CHANGELOG.md
CHANGED
@@ -5,6 +5,10 @@
|
|
5
5
|
🚀 IN PRODUCTION 🚀
|
6
6
|
(https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
|
7
7
|
|
8
|
+
# 2.10.5
|
9
|
+
- Fix bug on access chatbot route rules
|
10
|
+
- Fix bug update chatbot avatar
|
11
|
+
|
8
12
|
# 2.10.4
|
9
13
|
- Removed temporary conversation from default query to get all requests
|
10
14
|
- Removed draft conversation from requests count
|
package/package.json
CHANGED
package/routes/faq_kb.js
CHANGED
@@ -21,8 +21,6 @@ const roleConstants = require('../models/roleConstants');
|
|
21
21
|
|
22
22
|
let chatbot_templates_api_url = process.env.CHATBOT_TEMPLATES_API_URL
|
23
23
|
|
24
|
-
|
25
|
-
// Eliminare ? ['bot','subscription']
|
26
24
|
router.post('/', roleChecker.hasRole('admin'), async function (req, res) {
|
27
25
|
winston.debug('create BOT ', req.body);
|
28
26
|
|
@@ -45,7 +43,7 @@ router.post('/', roleChecker.hasRole('admin'), async function (req, res) {
|
|
45
43
|
|
46
44
|
});
|
47
45
|
|
48
|
-
router.post('/train', roleChecker.
|
46
|
+
router.post('/train', roleChecker.hasRole('admin'), function (req, res) {
|
49
47
|
|
50
48
|
winston.info('train BOT ', req.body);
|
51
49
|
|
@@ -116,7 +114,7 @@ router.post('/train', roleChecker.hasRoleOrTypes('admin', ['bot','subscription']
|
|
116
114
|
});
|
117
115
|
});
|
118
116
|
|
119
|
-
router.post('/aitrain/', roleChecker.
|
117
|
+
router.post('/aitrain/', roleChecker.hasRole('admin'), async (req, res) => {
|
120
118
|
|
121
119
|
let id_faq_kb = req.body.id_faq_kb;
|
122
120
|
let webhook_enabled = req.body.webhook_enabled;
|
@@ -156,7 +154,7 @@ router.post('/aitrain/', roleChecker.hasRoleOrTypes('admin', ['bot','subscriptio
|
|
156
154
|
})
|
157
155
|
})
|
158
156
|
|
159
|
-
router.post('/askbot', roleChecker.
|
157
|
+
router.post('/askbot', roleChecker.hasRole('admin'), function (req, res) {
|
160
158
|
|
161
159
|
winston.debug('ASK BOT ', req.body);
|
162
160
|
|
@@ -223,7 +221,6 @@ router.post('/askbot', roleChecker.hasRoleOrTypes('admin', ['bot','subscription'
|
|
223
221
|
});
|
224
222
|
});
|
225
223
|
|
226
|
-
// Eliminare ? ['bot','subscription']
|
227
224
|
router.put('/:faq_kbid/publish', roleChecker.hasRole('admin'), async (req, res) => {
|
228
225
|
|
229
226
|
let id_faq_kb = req.params.faq_kbid;
|
@@ -268,8 +265,7 @@ router.put('/:faq_kbid/publish', roleChecker.hasRole('admin'), async (req, res)
|
|
268
265
|
}
|
269
266
|
});
|
270
267
|
|
271
|
-
|
272
|
-
router.put('/:faq_kbid', roleChecker.hasRole('admin'), function (req, res) {
|
268
|
+
router.put('/:faq_kbid', roleChecker.hasRoleOrTypes('admin', ['bot','subscription']), function (req, res) {
|
273
269
|
|
274
270
|
winston.debug(req.body);
|
275
271
|
|
@@ -344,8 +340,7 @@ router.put('/:faq_kbid', roleChecker.hasRole('admin'), function (req, res) {
|
|
344
340
|
});
|
345
341
|
});
|
346
342
|
|
347
|
-
|
348
|
-
router.put('/:faq_kbid/language/:language', roleChecker.hasRole('admin'), (req, res) => {
|
343
|
+
router.put('/:faq_kbid/language/:language', roleChecker.hasRoleOrTypes('admin', ['bot','subscription']), (req, res) => {
|
349
344
|
|
350
345
|
winston.debug("update language: ", req.params);
|
351
346
|
|
@@ -372,8 +367,7 @@ router.put('/:faq_kbid/language/:language', roleChecker.hasRole('admin'), (req,
|
|
372
367
|
|
373
368
|
})
|
374
369
|
|
375
|
-
|
376
|
-
router.patch('/:faq_kbid/attributes', roleChecker.hasRole('admin'), function (req, res) { //TODO add cache_bot_here
|
370
|
+
router.patch('/:faq_kbid/attributes', roleChecker.hasRoleOrTypes('admin', ['bot','subscription']), function (req, res) { //TODO add cache_bot_here
|
377
371
|
var data = req.body;
|
378
372
|
|
379
373
|
// TODO use service method
|
@@ -419,7 +413,6 @@ router.patch('/:faq_kbid/attributes', roleChecker.hasRole('admin'), function (re
|
|
419
413
|
|
420
414
|
});
|
421
415
|
|
422
|
-
// Eliminare ? ['bot','subscription']
|
423
416
|
router.delete('/:faq_kbid', roleChecker.hasRole('admin'), function (req, res) {
|
424
417
|
|
425
418
|
winston.debug(req.body);
|
@@ -436,7 +429,7 @@ router.delete('/:faq_kbid', roleChecker.hasRole('admin'), function (req, res) {
|
|
436
429
|
});
|
437
430
|
});
|
438
431
|
|
439
|
-
router.get('/:faq_kbid', roleChecker.
|
432
|
+
router.get('/:faq_kbid', roleChecker.hasRoleOrTypes('admin', ['bot','subscription']), function (req, res) {
|
440
433
|
|
441
434
|
winston.debug(req.query);
|
442
435
|
|
@@ -481,7 +474,7 @@ router.get('/:faq_kbid', roleChecker.hasRole('admin'), function (req, res) {
|
|
481
474
|
});
|
482
475
|
});
|
483
476
|
|
484
|
-
router.get('/:faq_kbid/jwt', roleChecker.
|
477
|
+
router.get('/:faq_kbid/jwt', roleChecker.hasRoleOrTypes('admin', ['bot','subscription']), function (req, res) {
|
485
478
|
|
486
479
|
winston.debug(req.query);
|
487
480
|
|
@@ -522,7 +515,7 @@ router.get('/:faq_kbid/jwt', roleChecker.hasRole('admin'), function (req, res) {
|
|
522
515
|
* This endpoint should be the only one reachble with role agent.
|
523
516
|
* If the role is agent the response must contain only _id, name, or other non relevant info.
|
524
517
|
*/
|
525
|
-
router.get('/', roleChecker.
|
518
|
+
router.get('/', roleChecker.hasRoleOrTypes('agent', ['bot','subscription']), function (req, res) {
|
526
519
|
|
527
520
|
|
528
521
|
winston.debug("req.query", req.query);
|
@@ -531,7 +524,7 @@ router.get('/', roleChecker.hasRole('agent'), function (req, res) {
|
|
531
524
|
let restricted_mode = false;
|
532
525
|
|
533
526
|
let project_user = req.projectuser;
|
534
|
-
if (project_user.role === roleConstants.AGENT) {
|
527
|
+
if (project_user && project_user.role === roleConstants.AGENT) {
|
535
528
|
restricted_mode = true;
|
536
529
|
}
|
537
530
|
|
package/routes/images.js
CHANGED
@@ -198,11 +198,11 @@ uploadAvatar.single('file'), async (req, res, next) => {
|
|
198
198
|
|
199
199
|
let chatbot = await faq_kb.findById(bot_id).catch((err) => {
|
200
200
|
winston.error("Error finding bot ", err);
|
201
|
-
res.status(500).send({ success: false, error: "Unable to find chatbot with id " + bot_id });
|
201
|
+
return res.status(500).send({ success: false, error: "Unable to find chatbot with id " + bot_id });
|
202
202
|
})
|
203
203
|
|
204
204
|
if (!chatbot) {
|
205
|
-
res.status(404).send({ success: false, error: "Chatbot not found" })
|
205
|
+
return res.status(404).send({ success: false, error: "Chatbot not found" })
|
206
206
|
}
|
207
207
|
|
208
208
|
let id_project = chatbot.id_project;
|
@@ -295,7 +295,7 @@ class FileGridFsService extends FileService {
|
|
295
295
|
if (req.user && req.user.id) {
|
296
296
|
var userid = req.user.id;
|
297
297
|
|
298
|
-
if (req.query.
|
298
|
+
if (req.query.bot_id) {
|
299
299
|
winston.debug("req.query.user_id: "+ req.query.user_id);
|
300
300
|
// winston.info("req.projectuser ",req.projectuser);
|
301
301
|
|
@@ -303,7 +303,7 @@ class FileGridFsService extends FileService {
|
|
303
303
|
// if (req.project_user && req.project_user.role === ) {
|
304
304
|
|
305
305
|
// }
|
306
|
-
userid = req.query.
|
306
|
+
userid = req.query.bot_id;
|
307
307
|
}
|
308
308
|
subfolder = "/users/"+userid;
|
309
309
|
}
|