Sfoglia il codice sorgente

add middlewares and

keigo-h 3 anni fa
parent
commit
72ae0c7ea5

+ 2 - 0
packages/app/src/server/routes/admin.js

@@ -356,6 +356,8 @@ module.exports = function(crowi, app) {
 
     try {
       const zipFile = exportService.getFile(fileName);
+      const parameters = { action: SupportedAction.ACTION_ADMIN_ARCHIVE_DATA_DOWNLOAD };
+      crowi.activityService.createActivity(parameters);
       return res.download(zipFile);
     }
     catch (err) {

+ 3 - 1
packages/app/src/server/routes/apiv3/export.js

@@ -169,13 +169,15 @@ module.exports = (crowi) => {
    *              schema:
    *                type: object
    */
-  router.delete('/:fileName', accessTokenParser, loginRequired, adminRequired, validator.deleteFile, apiV3FormValidator, csrf, async(req, res) => {
+  router.delete('/:fileName', accessTokenParser, loginRequired, adminRequired, validator.deleteFile, apiV3FormValidator, csrf, addActivity, async(req, res) => {
     // TODO: add express validator
     const { fileName } = req.params;
 
     try {
       const zipFile = exportService.getFile(fileName);
       fs.unlinkSync(zipFile);
+      const parameters = { action: SupportedAction.ACTION_ADMIN_ARCHIVE_DATA_DELETE };
+      activityEvent.emit('update', res.locals.activity._id, parameters);
 
       // TODO: use res.apiv3
       return res.status(200).send({ ok: true });

+ 1 - 1
packages/app/src/server/routes/index.js

@@ -153,7 +153,7 @@ module.exports = function(crowi, app) {
 
   // export management for admin
   app.get('/admin/export'                       , loginRequiredStrictly , adminRequired ,admin.export.index);
-  app.get('/admin/export/:fileName'             , loginRequiredStrictly , adminRequired ,admin.export.api.validators.export.download(), admin.export.download);
+  app.get('/admin/export/:fileName'             , loginRequiredStrictly , adminRequired , addActivity , admin.export.api.validators.export.download(), admin.export.download);
 
   app.get('/admin/*'                            , loginRequiredStrictly ,adminRequired, admin.notFound.index);