mizozobu 6 лет назад
Родитель
Сommit
4567068b15
2 измененных файлов с 1 добавлено и 18 удалено
  1. 0 15
      src/server/models/config.js
  2. 1 3
      src/server/util/middlewares.js

+ 0 - 15
src/server/models/config.js

@@ -326,21 +326,6 @@ module.exports = function(crowi) {
     return method !== 'none';
   };
 
-  configSchema.statics.isGuestAllowedToRead = function(config) {
-    // return true if puclic wiki mode
-    if (crowi.aclService.getIsPublicWikiOnly()) {
-      return true;
-    }
-
-    const restrictGuestMode = crowi.configManager.getConfig('crowi', 'security:restrictGuestMode');
-    // return false if undefined
-    if (undefined === config.crowi || undefined === restrictGuestMode) {
-      return false;
-    }
-
-    return SECURITY_RESTRICT_GUEST_MODE_READONLY === restrictGuestMode;
-  };
-
   configSchema.statics.isEnabledLinebreaks = function(config) {
     const key = 'markdown:isEnabledLinebreaks';
     return getValueForMarkdownNS(config, key);

+ 1 - 3
src/server/util/middlewares.js

@@ -207,15 +207,13 @@ module.exports = (crowi, app) => {
    * @param {boolean} isStrictly whethere strictly restricted (default true)
    */
   middlewares.loginRequired = function(isStrictly = true) {
-    const isGuestAllowedToRead = crowi.aclService.getIsGuestAllowedToRead();
-
     return function(req, res, next) {
       const User = crowi.model('User');
 
       // when the route is not strictly restricted
       if (!isStrictly) {
         // when allowed to read
-        if (isGuestAllowedToRead) {
+        if (crowi.aclService.getIsGuestAllowedToRead()) {
           return next();
         }
       }