From 675743d39fa34a74dce4fc1edac62bc9144c9530 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 14 Apr 2019 17:01:54 +0200 Subject: [PATCH] Disable form to promote group to owner if owner is already set See #2890 --- .../files/lib/acp/form/UserGroupPromoteOwnerForm.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wcfsetup/install/files/lib/acp/form/UserGroupPromoteOwnerForm.class.php b/wcfsetup/install/files/lib/acp/form/UserGroupPromoteOwnerForm.class.php index ddbd167769..e78aff11c5 100644 --- a/wcfsetup/install/files/lib/acp/form/UserGroupPromoteOwnerForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserGroupPromoteOwnerForm.class.php @@ -3,6 +3,7 @@ namespace wcf\acp\form; use wcf\data\user\group\UserGroup; use wcf\data\user\group\UserGroupAction; use wcf\form\AbstractForm; +use wcf\system\exception\IllegalLinkException; use wcf\system\form\builder\container\FormContainer; use wcf\system\form\builder\field\RadioButtonFormField; use wcf\system\form\builder\FormDocument; @@ -47,6 +48,11 @@ class UserGroupPromoteOwnerForm extends AbstractForm { public function readParameters() { parent::readParameters(); + // owner user groups cannot be modified + if (UserGroup::getOwnerGroupID() !== null) { + throw new IllegalLinkException(); + } + $this->groups = UserGroup::getGroupsByType([UserGroup::OTHER]); $this->groups = array_filter($this->groups, function (UserGroup $group) { return $group->isAdminGroup(); -- 2.20.1