Add requireMultifactor property to user groups
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 26 Jan 2021 13:49:59 +0000 (14:49 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 26 Jan 2021 14:15:28 +0000 (15:15 +0100)
wcfsetup/install/files/acp/templates/userGroupAdd.tpl
wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_db.php
wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php
wcfsetup/install/files/lib/acp/form/UserGroupEditForm.class.php
wcfsetup/install/files/lib/data/user/group/UserGroup.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml
wcfsetup/setup/db/install.sql

index a01205c89b69b5891147c9c1d4ede80c44c7abaf..b095031ee0cbc89e9f6c1872c82ec10209c5437b 100644 (file)
                        </dl>
                {/if}
                
+               {if $action == 'add' || $group->groupType > 3}
+                       <dl>
+                               <dt></dt>
+                               <dd>
+                                       <label><input type="checkbox" id="requireMultifactor" name="requireMultifactor" value="1"{if $requireMultifactor} checked{/if}> {lang}wcf.acp.group.requireMultifactor{/lang}</label>
+                                       
+                                       <small>{lang}wcf.acp.group.requireMultifactor.description{/lang}</small>
+                               </dd>
+                       </dl>
+               {/if}
+               
                {if MODULE_TEAM_PAGE && ($action == 'add' || $group->groupType > 3)}
                        <dl>
                                <dt></dt>
index 27d5e5110c3f3bb4a5f80e6368a80e790519a545..489c7416af8e146b67e4c66a8a627d6ca97b3ac8 100644 (file)
@@ -78,6 +78,11 @@ $tables = [
             DefaultFalseBooleanDatabaseTableColumn::create("hasWebP"),
         ]),
 
+    PartialDatabaseTable::create('wcf1_user_group')
+        ->columns([
+            DefaultFalseBooleanDatabaseTableColumn::create('requireMultifactor'),
+        ]),
+
     DatabaseTable::create('wcf1_user_multifactor')
         ->columns([
             ObjectIdDatabaseTableColumn::create('setupID'),
index 3bd79715eb52296f291ba40ae55c9b667d85a6fc..cf073030f8c1298f991f3c27aa55b09fff5ae8e6 100755 (executable)
@@ -89,6 +89,11 @@ class UserGroupAddForm extends AbstractOptionListForm
      */
     protected $allowMention = 0;
 
+    /**
+     * @var int
+     */
+    protected $requireMultifactor = 0;
+
     /**
      * @inheritDoc
      */
@@ -128,6 +133,9 @@ class UserGroupAddForm extends AbstractOptionListForm
         if (isset($_POST['allowMention'])) {
             $this->allowMention = \intval($_POST['allowMention']);
         }
+        if (isset($_POST['requireMultifactor'])) {
+            $this->requireMultifactor = \intval($_POST['requireMultifactor']);
+        }
     }
 
     /**
@@ -176,6 +184,7 @@ class UserGroupAddForm extends AbstractOptionListForm
                 'userOnlineMarking' => $this->userOnlineMarking,
                 'showOnTeamPage' => $this->showOnTeamPage,
                 'allowMention' => $this->allowMention ? 1 : 0,
+                'requireMultifactor' => $this->requireMultifactor ? 1 : 0,
             ]),
             'options' => $optionValues,
         ];
@@ -222,7 +231,7 @@ class UserGroupAddForm extends AbstractOptionListForm
         // reset values
         $this->groupName = '';
         $this->userOnlineMarking = '%s';
-        $this->allowMention = $this->priority = $this->showOnTeamPage = 0;
+        $this->requireMultifactor = $this->allowMention = $this->priority = $this->showOnTeamPage = 0;
 
         I18nHandler::getInstance()->reset();
     }
@@ -260,6 +269,7 @@ class UserGroupAddForm extends AbstractOptionListForm
             'groupIsGuest' => false,
             'isBlankForm' => empty($_POST),
             'allowMention' => $this->allowMention,
+            'requireMultifactor' => $this->requireMultifactor,
         ]);
     }
 
index fcbfac419c3517f9c8f0bd2b8ffbed97000ccd79..d6c5db10341adc0268a598af402b63094994450b 100755 (executable)
@@ -117,6 +117,7 @@ class UserGroupEditForm extends UserGroupAddForm
             $this->userOnlineMarking = $this->group->userOnlineMarking;
             $this->showOnTeamPage = $this->group->showOnTeamPage;
             $this->allowMention = $this->group->allowMention;
+            $this->requireMultifactor = $this->group->requireMultifactor;
         }
 
         parent::readData();
@@ -194,6 +195,7 @@ class UserGroupEditForm extends UserGroupAddForm
                 'userOnlineMarking' => $this->userOnlineMarking,
                 'showOnTeamPage' => $this->showOnTeamPage,
                 'allowMention' => $this->allowMention,
+                'requireMultifactor' => $this->requireMultifactor,
             ]),
             'options' => $optionValues,
         ]);
index 29af999e83c15d42b28b7dbb1e203e3851a7243c..d130003eeb44e76f81d3e38a5b7440639cd885c9 100644 (file)
@@ -32,6 +32,8 @@ use wcf\system\WCF;
  *                should be shown on the team page, otherwise `0`
  * @property-read       int $allowMention           is `1` if the user group can be mentioned in messages,
  *                      otherwise `0`
+ * @property-read       int $requireMultifactor           is `1` if group members need to set up multi-factor
+ *                      authentcation, otherwise `0`
  */
 class UserGroup extends DatabaseObject implements ITitledObject
 {
index af34bed040667f60aabe33b64adb1d967eb65adc..9502be345ba7328a79d0270afdf6c35326ff7bc0 100644 (file)
@@ -906,6 +906,8 @@ ACHTUNG: Die oben genannten Meldungen sind stark gekürzt. Sie können Details z
                <item name="wcf.acp.group.option.user.signature.attachment.allowedExtensions"><![CDATA[Erlaubte Dateiendungen]]></item>
                <item name="wcf.acp.group.option.user.signature.attachment.allowedExtensions.description"><![CDATA[Eine Dateiendung pro Zeile]]></item>
                <item name="wcf.acp.group.option.user.signature.attachment.maxCount"><![CDATA[Maximale Dateianhänge]]></item>
+               <item name="wcf.acp.group.requireMultifactor"><![CDATA[Mehrfaktor-Authentifizierung erzwingen]]></item>
+               <item name="wcf.acp.group.requireMultifactor.description"><![CDATA[Benutzer, die Mitglied dieser Benutzergruppe sind, können die Mehrfaktor-Authentifizierung nicht deaktivieren und können besonders geschützte Bereiche erst betreten, wenn sie die Mehrfaktor-Authentifizierung eingerichtet haben.]]></item>
        </category>
        <category name="wcf.acp.index">
                <item name="wcf.acp.index.credits"><![CDATA[Über WoltLab Suite&trade;]]></item>
index f02cff20b34c060eb73b8cbbf6d46d72b0a733a4..43a88615a971afbc31f6473bbd02b220d124054c 100644 (file)
@@ -883,6 +883,8 @@ ATTENTION: The messages listed above are greatly shortened. You can view details
                <item name="wcf.acp.group.option.user.signature.attachment.allowedExtensions"><![CDATA[Allowed Attachment File Extensions]]></item>
                <item name="wcf.acp.group.option.user.signature.attachment.allowedExtensions.description"><![CDATA[Enter one extension per line.]]></item>
                <item name="wcf.acp.group.option.user.signature.attachment.maxCount"><![CDATA[Maximum Attachments]]></item>
+               <item name="wcf.acp.group.requireMultifactor"><![CDATA[Require Multi-factor Authentication]]></item>
+               <item name="wcf.acp.group.requireMultifactor.description"><![CDATA[Users that are members of this user group may not disable multi-factor authentication. They will also be required to set up multi-factor authentication before they may enter protected areas.]]></item>
        </category>
        <category name="wcf.acp.index">
                <item name="wcf.acp.index.credits"><![CDATA[About WoltLab Suite&trade;]]></item>
index 40829f4d6875cb5233a79db52741d2fb735e5f47..3c87fa3b351a720ca20fb1cc14c38d6aa91a8273 100644 (file)
@@ -1571,7 +1571,8 @@ CREATE TABLE wcf1_user_group (
        priority MEDIUMINT(8) NOT NULL DEFAULT 0,
        userOnlineMarking VARCHAR(255) NOT NULL DEFAULT '%s',
        showOnTeamPage TINYINT(1) NOT NULL DEFAULT 0,
-       allowMention TINYINT(1) NOT NULL DEFAULT 0
+       allowMention TINYINT(1) NOT NULL DEFAULT 0,
+       requireMultifactor TINYINT(1) NOT NULL DEFAULT 0
 );
 
 DROP TABLE IF EXISTS wcf1_user_group_assignment;