From: Matthias Schmidt Date: Fri, 25 Mar 2016 20:00:37 +0000 (+0100) Subject: Fix listing of user group members in ACP X-Git-Tag: 3.0.0_Beta_1~1286^2~41 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4d24f661da7d8b6795b92b9972ffa5fd0cc117e6;p=GitHub%2FWoltLab%2FWCF.git Fix listing of user group members in ACP --- diff --git a/wcfsetup/install/files/lib/acp/form/UserSearchForm.class.php b/wcfsetup/install/files/lib/acp/form/UserSearchForm.class.php index 526d6d34bb..0032d4efc3 100755 --- a/wcfsetup/install/files/lib/acp/form/UserSearchForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserSearchForm.class.php @@ -1,10 +1,15 @@ groupIDs[] = intval($_GET['groupID']); + $this->groupID = intval($_GET['groupID']); // disable check for security token for GET requests $_POST['t'] = WCF::getSession()->getSecurityToken(); // do search try { + $this->readData(); $this->validate(); $this->save(); } @@ -204,8 +217,25 @@ class UserSearchForm extends UserOptionListForm { } foreach ($this->conditions as $conditions) { - foreach ($conditions as $condition) { - $condition->getProcessor()->validate(); + /** @var ObjectType $objectType */ + foreach ($conditions as $objectType) { + /** @var IUserCondition $processor */ + $processor = $objectType->getProcessor(); + + // manually inject user group data for listing of group members + if ($this->groupID && $objectType->objectType == 'com.woltlab.wcf.userGroup') { + $userGroups = UserGroup::getAccessibleGroups([], [UserGroup::EVERYONE, UserGroup::GUESTS]); + + uasort($userGroups, function(UserGroup $groupA, UserGroup $groupB) { + return strcmp($groupA->getName(), $groupB->getName()); + }); + + $processor->setUserGroups($userGroups); + $processor->setData(new Condition(null, [ + 'conditionData' => serialize(['groupIDs' => [$this->groupID]]) + ])); + } + $processor->validate(); } } diff --git a/wcfsetup/install/files/lib/system/condition/UserGroupCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserGroupCondition.class.php index 4f08f614dc..0e6ef75f8e 100644 --- a/wcfsetup/install/files/lib/system/condition/UserGroupCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserGroupCondition.class.php @@ -201,6 +201,15 @@ HTML; } } + /** + * Sets the selectable user groups. + * + * @param UserGroup[] $userGroups + */ + public function setUserGroups(array $userGroups) { + $this->userGroups = $userGroups; + } + /** * @see \wcf\system\condition\ICondition::validate() */