2
0
Seiya Tashiro 7 жил өмнө
parent
commit
1187cf3474

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

@@ -129,6 +129,12 @@ module.exports = function(crowi) {
     };
     };
   }
   }
 
 
+  function getDefaultEnv() {
+    return {
+      'USER_UPPER_LIMIT': 0,
+    };
+  }
+
   function getValueForCrowiNS(config, key) {
   function getValueForCrowiNS(config, key) {
     // return the default value if undefined
     // return the default value if undefined
     if (undefined === config.crowi || undefined === config.crowi[key]) {
     if (undefined === config.crowi || undefined === config.crowi[key]) {
@@ -147,6 +153,13 @@ module.exports = function(crowi) {
     return config.markdown[key];
     return config.markdown[key];
   }
   }
 
 
+  function getValueEnv(crowi, key) {
+    if (null == crowi.env || null == crowi.env[key]) {
+      return getDefaultEnv()[key];
+    }
+    return crowi.env[key];
+  }
+
   configSchema.statics.getRestrictGuestModeLabels = function() {
   configSchema.statics.getRestrictGuestModeLabels = function() {
     var labels = {};
     var labels = {};
     labels[SECURITY_RESTRICT_GUEST_MODE_DENY]     = 'security_setting.guest_mode.deny';
     labels[SECURITY_RESTRICT_GUEST_MODE_DENY]     = 'security_setting.guest_mode.deny';
@@ -597,6 +610,11 @@ module.exports = function(crowi) {
     return local_config;
     return local_config;
   };
   };
 
 
+  configSchema.statics.userUpperLimit = function(crowi) {
+    const key = 'USER_UPPER_LIMIT';
+    return Number(getValueEnv(crowi, key));
+  };
+
   /*
   /*
   configSchema.statics.isInstalled = function(config)
   configSchema.statics.isInstalled = function(config)
   {
   {