WESEEK Kaito 6 лет назад
Родитель
Сommit
fa217afca2

+ 21 - 2
src/client/js/components/Admin/Security/SecuritySetting.jsx

@@ -23,7 +23,7 @@ class SecuritySetting extends React.Component {
             >
             >
               { t('security_setting.Guest Users Access') }
               { t('security_setting.Guest Users Access') }
             </label>
             </label>
-            {adminGeneralSecurityContainer.state.isForceWikiMode == false && (
+            {adminGeneralSecurityContainer.state.isForceWikiMode === false && (
               <div className="col-xs-9 text-left">
               <div className="col-xs-9 text-left">
                 <div className="my-0 btn-group">
                 <div className="my-0 btn-group">
                   <div className="dropdown">
                   <div className="dropdown">
@@ -33,6 +33,25 @@ class SecuritySetting extends React.Component {
                         <span className="caret" />
                         <span className="caret" />
                       </span>
                       </span>
                     </button>
                     </button>
+                    {/* TODO adjust dropdown after BS4 */}
+                    <ul className="dropdown-menu" role="menu">
+                      <li
+                        key="deny"
+                        role="presentation"
+                        type="button"
+                        onClick={() => { adminGeneralSecurityContainer.changeRestrictGuestMode('Deny') }}
+                      >
+                        <a role="menuitem">{ t('security_setting.guest_mode.deny') }</a>
+                      </li>
+                      <li
+                        key="Readonly"
+                        role="presentation"
+                        type="button"
+                        onClick={() => { adminGeneralSecurityContainer.changeRestrictGuestMode('Readonly') }}
+                      >
+                        <a role="menuitem">{ t('security_setting.guest_mode.readonly') }</a>
+                      </li>
+                    </ul>
                   </div>
                   </div>
                 </div>
                 </div>
               </div>
               </div>
@@ -45,7 +64,7 @@ class SecuritySetting extends React.Component {
                   { t('security_setting.Fixed by env var', 'FORCE_WIKI_MODE') }<br></br>
                   { t('security_setting.Fixed by env var', 'FORCE_WIKI_MODE') }<br></br>
                 </p>
                 </p>
               </div>
               </div>
-              )}
+            )}
           </div>
           </div>
           <div className="form-group">
           <div className="form-group">
             <label htmlFor="{{configName}}" className="col-xs-3 control-label">{ t('security_setting.page_listing_1') }</label>
             <label htmlFor="{{configName}}" className="col-xs-3 control-label">{ t('security_setting.page_listing_1') }</label>

+ 3 - 2
src/client/js/services/AdminGeneralSecurityContainer.js

@@ -35,6 +35,7 @@ export default class AdminGeneralSecurityContainer extends Container {
 
 
     this.switchIsLocalEnabled = this.switchIsLocalEnabled.bind(this);
     this.switchIsLocalEnabled = this.switchIsLocalEnabled.bind(this);
     this.changeRegistrationMode = this.changeRegistrationMode.bind(this);
     this.changeRegistrationMode = this.changeRegistrationMode.bind(this);
+    this.changeRestrictGuestMode = this.changeRestrictGuestMode.bind(this);
   }
   }
 
 
   init() {
   init() {
@@ -78,9 +79,9 @@ export default class AdminGeneralSecurityContainer extends Container {
   }
   }
 
 
   /**
   /**
-   * Switch restrictGuestMode
+   * Change restrictGuestMode
    */
    */
-  switchRestrictGuestMode(restrictGuestModeLabel) {
+  changeRestrictGuestMode(restrictGuestModeLabel) {
     this.setState({ currentRestrictGuestMode: restrictGuestModeLabel });
     this.setState({ currentRestrictGuestMode: restrictGuestModeLabel });
   }
   }