Przeglądaj źródła

If wikiMode is "public", save the grant as public

Shun Miyazawa 3 lat temu
rodzic
commit
13e80ee578
1 zmienionych plików z 4 dodań i 1 usunięć
  1. 4 1
      packages/app/src/server/routes/attachment.js

+ 4 - 1
packages/app/src/server/routes/attachment.js

@@ -468,7 +468,10 @@ module.exports = function(crowi, app) {
     if (pageId == null) {
       logger.debug('Create page before file upload');
 
-      page = await crowi.pageService.create(pagePath, `# ${pagePath}`, req.user, { grant: Page.GRANT_OWNER });
+      const wikiMode = crowi.configManager.getConfig('crowi', 'security:wikiMode');
+      const grant = wikiMode === 'public' ? Page.GRANT_PUBLIC : Page.GRANT_OWNER;
+
+      page = await crowi.pageService.create(pagePath, `# ${pagePath}`, req.user, { grant });
       pageCreated = true;
       pageId = page._id;
     }