By now every instance should have an owner group.
</instructions>
<instructions type="update" fromversion="5.3.*">
+ <instruction type="script" run="standalone">acp/update_com.woltlab.wcf_5.4_checkOwnerGroup.php</instruction>
+
<instruction type="file" />
<instruction type="acpTemplate" />
<instruction type="template" />
{if $__isRescueMode|empty}{include file='pageMenuMobile'}{/if}
-{if !$__wscMissingOwnerGroup|empty}
- <div id="wscMissingOwnerGroup" role="alert">{lang}wcf.acp.group.missingOwnerGroup{/lang}</div>
-{/if}
-
{event name='footer'}
<!-- JAVASCRIPT_RELOCATE_POSITION -->
+++ /dev/null
-{include file='header' pageTitle='wcf.acp.group.promoteOwner'}
-
-<header class="contentHeader">
- <div class="contentHeaderTitle">
- <h1 class="contentTitle">{lang}wcf.acp.group.promoteOwner{/lang}</h1>
- </div>
-</header>
-
-<div class="warning">{lang}wcf.acp.group.promoteOwner.warning{/lang}</div>
-
-{@$form->getHtml()}
-
-{include file='footer'}
--- /dev/null
+<?php
+
+use wcf\data\user\group\UserGroup;
+use wcf\system\WCF;
+
+if (UserGroup::getOwnerGroupID() === null) {
+ if (WCF::getLanguage()->getFixedLanguageCode() === 'de') {
+ $message = "Es wurde noch keine Besitzer-Gruppe festgelegt.";
+ }
+ else {
+ $message = "No owner group was specified yet.";
+ }
+
+ throw new \RuntimeException($message);
+}
use wcf\system\WCF;
$files = [
+ 'lib/acp/form/UserGroupPromoteOwnerForm.class.php',
'lib/system/database/table/DatabaseTableUtil.class.php',
];
+++ /dev/null
-<?php
-namespace wcf\acp\form;
-use wcf\data\user\group\UserGroup;
-use wcf\data\user\group\UserGroupAction;
-use wcf\form\AbstractForm;
-use wcf\form\AbstractFormBuilderForm;
-use wcf\system\exception\IllegalLinkException;
-use wcf\system\form\builder\container\FormContainer;
-use wcf\system\form\builder\field\RadioButtonFormField;
-use wcf\system\request\LinkHandler;
-use wcf\system\WCF;
-use wcf\util\HeaderUtil;
-
-/**
- * Promotes a user group to be the owner group.
- *
- * @author ALexander Ebert
- * @copyright 2001-2019 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package WoltLabSuite\Core\Acp\Form
- * @since 5.2
- */
-class UserGroupPromoteOwnerForm extends AbstractFormBuilderForm {
- /**
- * @inheritDoc
- */
- public $activeMenuItem = 'wcf.acp.menu.link.group.list';
-
- /**
- * user groups that can be promoted to owner group
- * @var UserGroup[]
- */
- public $groups = [];
-
- /**
- * @inheritDoc
- */
- public $neededPermissions = ['admin.configuration.package.canInstallPackage'];
-
- /**
- * @inheritDoc
- */
- public function readParameters() {
- parent::readParameters();
-
- // owner user groups cannot be modified
- if (UserGroup::getOwnerGroupID() !== null) {
- throw new IllegalLinkException();
- }
-
- $this->groups = UserGroup::getSortedGroupsByType([UserGroup::OTHER]);
- $this->groups = array_filter($this->groups, function (UserGroup $group) {
- return $group->isAdminGroup();
- });
-
- if (empty($this->groups)) {
- // fallback for broken installations without an admin group
- $this->groups = UserGroup::getSortedGroupsByType([UserGroup::OTHER]);
- }
- }
-
- /**
- * @inheritDoc
- */
- protected function createForm() {
- parent::createForm();
-
- $this->form->appendChild(
- FormContainer::create('groupSection')
- ->appendChild(
- RadioButtonFormField::create('groupID')
- ->label('wcf.acp.group.promoteOwner.group')
- ->required()
- ->options($this->groups)
- )
- );
- }
-
- /**
- * @inheritDoc
- */
- public function save() {
- AbstractForm::save();
-
- $groupID = $this->form->getData()['data']['groupID'];
-
- $this->objectAction = new UserGroupAction([$this->groups[$groupID]], 'promoteOwner');
- $this->objectAction->executeAction();
-
- AbstractForm::saved();
-
- HeaderUtil::redirect(LinkHandler::getInstance()->getLink());
- exit;
- }
-
- /**
- * @inheritDoc
- */
- public function assignVariables() {
- parent::assignVariables();
-
- WCF::getTPL()->assign([
- // Hide the notice on this page only.
- '__wscMissingOwnerGroup' => false,
- ]);
- }
-}
]),
];
}
-
- public function promoteOwner() {
- if (UserGroup::getOwnerGroupID() !== null) {
- throw new \LogicException('There is already an owner group.');
- }
- else if (count($this->objects) !== 1) {
- throw new \InvalidArgumentException('Only a single group can be promoted to be the owner group.');
- }
-
- $groupEditor = reset($this->objects);
- $groupEditor->update([
- 'groupType' => UserGroup::OWNER,
- ]);
-
- UserGroupEditor::resetCache();
- }
}
<item name="wcf.acp.group.type.owner"><![CDATA[Besitzer]]></item>
<item name="wcf.acp.group.type.owner.description"><![CDATA[Die Besitzer-Gruppe verfügt über nicht entziehbare Berechtigungen und kann von anderen Gruppen nicht bearbeitet werden, diese Gruppe kann nur durch die Besitzer-Gruppe selbst bearbeitet werden. Mitglieder dieser Gruppe können andere Benutzer zu dieser Gruppe hinzufügen, sich aber selbst nicht daraus entfernen.]]></item>
<item name="wcf.acp.group.ownerGroupPermission"><![CDATA[Die Besitzer-Gruppe verfügt immer über diese Berechtigung, sie kann nicht entzogen werden.]]></item>
- <item name="wcf.acp.group.missingOwnerGroup"><![CDATA[Es wurde noch keine Besitzer-Gruppe festgelegt, <a href="{link controller='UserGroupPromoteOwner'}{/link}">bitte {if LANGUAGE_USE_INFORMAL_VARIANT}lege{else}legen Sie{/if} diese umgehend fest</a>.]]></item>
- <item name="wcf.acp.group.promoteOwner"><![CDATA[Besitzer-Gruppe festlegen]]></item>
- <item name="wcf.acp.group.promoteOwner.group"><![CDATA[Besitzer-Gruppe auswählen]]></item>
- <item name="wcf.acp.group.promoteOwner.warning"><![CDATA[Die Besitzer-Gruppe kann, einmal festgelegt, nicht mehr geändert werden. Diese Gruppe verfügt über besondere Berechtigungen und wird vor Änderungen durch andere Gruppen geschützt, Mitglieder dieser Gruppe können nicht mehr gesperrt werden.]]></item>
<item name="wcf.acp.group.option.user.signature.attachment.canUpload"><![CDATA[Kann Dateianhänge hochladen]]></item>
<item name="wcf.acp.group.option.user.signature.attachment.maxSize"><![CDATA[Maximale Dateianhangsgröße]]></item>
<item name="wcf.acp.group.option.user.signature.attachment.allowedExtensions"><![CDATA[Erlaubte Dateiendungen]]></item>
<item name="wcf.acp.group.type.owner"><![CDATA[Owner]]></item>
<item name="wcf.acp.group.type.owner.description"><![CDATA[The owner group features a few irrevocable permissions and is protected from edits by other groups, only the owner group can edit itself. Members of this group can add other users to this group, but cannot remove themselves.]]></item>
<item name="wcf.acp.group.ownerGroupPermission"><![CDATA[The owner group always has this permission, it cannot be revoked.]]></item>
- <item name="wcf.acp.group.missingOwnerGroup"><![CDATA[No owner group has been configured yet, <a href="{link controller='UserGroupPromoteOwner'}{/link}">please set it up now</a>.]]></item>
- <item name="wcf.acp.group.promoteOwner"><![CDATA[Set Up the Owner Group]]></item>
- <item name="wcf.acp.group.promoteOwner.group"><![CDATA[Select the owner group]]></item>
- <item name="wcf.acp.group.promoteOwner.warning"><![CDATA[The owner group cannot be modified once it has been set up. This group has special privileges and is protected from modifications by any other group, its members cannot be banned.]]></item>
<item name="wcf.acp.group.option.user.signature.attachment.canUpload"><![CDATA[Can Upload Attachments]]></item>
<item name="wcf.acp.group.option.user.signature.attachment.maxSize"><![CDATA[Maximum Attachment File Size]]></item>
<item name="wcf.acp.group.option.user.signature.attachment.allowedExtensions"><![CDATA[Allowed Attachment File Extensions]]></item>