shinoka7 6 лет назад
Родитель
Сommit
460efcbd47

+ 4 - 1
README.md

@@ -172,7 +172,10 @@ Environment Variables
     * MONGO_GRIDFS_TOTAL_LIMIT: Total capacity limit of MongoDB GridFS (bytes). default: `Infinity`
     * SAML_USES_ONLY_ENV_VARS_FOR_SOME_OPTIONS: If `true`, the system uses only the value of the environment variable as the value of the SAML option that can be set via the environment variable.
     * PUBLISH_OPEN_API: Publish GROWI OpenAPI resources with [ReDoc](https://github.com/Rebilly/ReDoc). Visit `/api-docs`.
-    * WIKI_MODE: Determines wiki mode (`public`, `private` or undefined). default: undefined
+    * FORCE_WIKI_MODE: Forces wiki mode. default: undefined
+      * `public`  : Forces all pages to become public
+      * `private` : Forces all pages to become private
+      * undefined : Publicity will be configured by the admin security page settings
 * **Option to integrate with external systems**
     * HACKMD_URI: URI to connect to [HackMD(CodiMD)](https://hackmd.io/) server.
         * **This server must load the GROWI agent. [Here's how to prepare it](https://docs.growi.org/guide/admin-cookbook/integrate-with-hackmd.html).**

+ 1 - 1
config/env.dev.js

@@ -13,5 +13,5 @@ module.exports = {
   // PUBLISH_OPEN_API: true,
   // USER_UPPER_LIMIT: 0,
   // DEV_HTTPS: true,
-  // WIKI_MODE: 'private', // 'public', 'private', undefined
+  // FORCE_WIKI_MODE: 'private', // 'public', 'private', undefined
 };

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

@@ -18,8 +18,9 @@ class AclService {
 
   isAclEnabled() {
     const wikiMode = this.configManager.getConfig('crowi', 'security:wikiMode');
+    const isPrivateOrPublic = wikiMode === 'private' || wikiMode === 'public';
 
-    return wikiMode === undefined;
+    return !isPrivateOrPublic;
   }
 
   getIsGuestAllowedToRead() {

+ 1 - 1
src/server/service/config-loader.js

@@ -134,7 +134,7 @@ const ENV_VAR_NAME_TO_CONFIG_INFO = {
     type:    TYPES.NUMBER,
     default: Infinity,
   },
-  WIKI_MODE: {
+  FORCE_WIKI_MODE: {
     ns:      'crowi',
     key:     'security:wikiMode',
     type:    TYPES.STRING,

+ 1 - 1
src/server/views/admin/security.html

@@ -45,7 +45,7 @@
             <div class="col-xs-6">
               <select class="form-control selectpicker" name="settingForm[security:restrictGuestMode]" value="{{ getConfig('crowi', 'security:restrictGuestMode') }}">
                 {% for modeValue, modeLabel in consts.restrictGuestMode %}
-                <option value="{{ t(modeValue) }}" {% if modeValue == getConfig('crowi', 'security:restrictGuestMode') %}selected{% endif %} {% if getConfig('crowi', 'security:wikiMode') %}disabled{% endif %}>{{ t(modeLabel) }}</option>
+                <option value="{{ t(modeValue) }}" {% if modeValue == getConfig('crowi', 'security:restrictGuestMode') %}selected{% endif %} {% if getConfig('crowi', 'security:wikiMode') == 'private' || getConfig('crowi', 'security:wikiMode') == 'public' %}disabled{% endif %}>{{ t(modeLabel) }}</option>
                 {% endfor %}
               </select>
             </div>