From: Matthias Schmidt Date: Sun, 14 Apr 2019 15:01:54 +0000 (+0200) Subject: Disable form to promote group to owner if owner is already set X-Git-Tag: 5.2.0_Alpha_1~136^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=675743d39fa34a74dce4fc1edac62bc9144c9530;p=GitHub%2FWoltLab%2FWCF.git Disable form to promote group to owner if owner is already set See #2890 --- 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();