itizawa 6 лет назад
Родитель
Сommit
dd63545edf
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      src/server/routes/page.js

+ 5 - 1
src/server/routes/page.js

@@ -549,7 +549,7 @@ module.exports = function(crowi, app) {
   api.create = async function(req, res) {
     const body = req.body.body || null;
     const pagePath = req.body.path || null;
-    const grant = req.body.grant || 1;
+    const grant = req.body.grant || null;
     const grantUserGroupId = req.body.grantUserGroupId || null;
     const overwriteScopesOfDescendants = req.body.overwriteScopesOfDescendants || null;
     const isSlackEnabled = !!req.body.isSlackEnabled; // cast to boolean
@@ -561,6 +561,10 @@ module.exports = function(crowi, app) {
       return res.json(ApiResponse.error('Parameters body and path are required.'));
     }
 
+    if (!grant) {
+      return res.json(ApiResponse.error('Grant is not selected'));
+    }
+
     // check page existence
     const isExist = await Page.count({ path: pagePath }) > 0;
     if (isExist) {