Taichi Masuyama 4 лет назад
Родитель
Сommit
715965e280
1 измененных файлов с 6 добавлено и 3 удалено
  1. 6 3
      packages/app/src/server/routes/apiv3/security-setting.js

+ 6 - 3
packages/app/src/server/routes/apiv3/security-setting.js

@@ -3,7 +3,7 @@ import { removeNullPropertyFromObject } from '~/utils/object-utils';
 
 
 import { PageDeleteConfigValue } from '~/interfaces/page-delete-config';
 import { PageDeleteConfigValue } from '~/interfaces/page-delete-config';
 import { apiV3FormValidator } from '../../middlewares/apiv3-form-validator';
 import { apiV3FormValidator } from '../../middlewares/apiv3-form-validator';
-import { validateDeleteConfigs } from '~/utils/page-delete-config';
+import { validateDeleteConfigs, prepareDeleteConfigValuesForCalc } from '~/utils/page-delete-config';
 
 
 const logger = loggerFactory('growi:routes:apiv3:security-setting');
 const logger = loggerFactory('growi:routes:apiv3:security-setting');
 
 
@@ -598,8 +598,11 @@ module.exports = (crowi) => {
     };
     };
 
 
     // Validate delete config
     // Validate delete config
-    const isDeleteConfigNormalized = !validateDeleteConfigs(req.body.pageDeletionAuthority, req.body.pageRecursiveDeletionAuthority)
-      && validateDeleteConfigs(req.body.pageCompleteDeletionAuthority, req.body.pageRecursiveCompleteDeletionAuthority);
+    const [singleAuthority1, recursiveAuthority1] = prepareDeleteConfigValuesForCalc(req.body.pageDeletionAuthority, req.body.pageRecursiveDeletionAuthority);
+    // eslint-disable-next-line max-len
+    const [singleAuthority2, recursiveAuthority2] = prepareDeleteConfigValuesForCalc(req.body.pageCompleteDeletionAuthority, req.body.req.body.pageRecursiveCompleteDeletionAuthority);
+    const isDeleteConfigNormalized = !validateDeleteConfigs(singleAuthority1, recursiveAuthority1)
+      && !validateDeleteConfigs(singleAuthority2, recursiveAuthority2);
     if (!isDeleteConfigNormalized) {
     if (!isDeleteConfigNormalized) {
       return res.apiv3Err(new ErrorV3('Delete config values are not correct.', 'delete_config_not_normalized'));
       return res.apiv3Err(new ErrorV3('Delete config values are not correct.', 'delete_config_not_normalized'));
     }
     }