Yuki Takei 6 лет назад
Родитель
Сommit
4a32a67954
2 измененных файлов с 13 добавлено и 2 удалено
  1. 7 2
      src/server/service/acl.js
  2. 6 0
      src/server/service/config-loader.js

+ 7 - 2
src/server/service/acl.js

@@ -18,14 +18,19 @@ class AclService {
 
   isAclEnabled() {
     const isPublicWikiOnly = this.configManager.getConfig('crowi', 'security:isPublicWikiOnly');
-    // const isPrivateWikiOnly = this.configManager.getConfig('crowi', 'security:isPrivateWikiOnly');
+    const isPrivateWikiOnly = this.configManager.getConfig('crowi', 'security:isPrivateWikiOnly');
 
-    return !(isPublicWikiOnly);
+    return !(isPublicWikiOnly || isPrivateWikiOnly);
   }
 
   getIsGuestAllowedToRead() {
     const isPublicWikiOnly = this.configManager.getConfig('crowi', 'security:isPublicWikiOnly');
+    const isPrivateWikiOnly = this.configManager.getConfig('crowi', 'security:isPrivateWikiOnly');
 
+    // return false if private wiki mode
+    if (isPrivateWikiOnly) {
+      return false;
+    }
     // return true if puclic wiki mode
     if (isPublicWikiOnly) {
       return true;

+ 6 - 0
src/server/service/config-loader.js

@@ -140,6 +140,12 @@ const ENV_VAR_NAME_TO_CONFIG_INFO = {
     type:    TYPES.BOOLEAN,
     default: false,
   },
+  PRIVATE_WIKI_ONLY: {
+    ns:      'crowi',
+    key:     'security:isPrivateWikiOnly',
+    type:    TYPES.BOOLEAN,
+    default: false,
+  },
   SAML_USES_ONLY_ENV_VARS_FOR_SOME_OPTIONS: {
     ns:      'crowi',
     key:     'security:passport-saml:useOnlyEnvVarsForSomeOptions',