From 4d24f661da7d8b6795b92b9972ffa5fd0cc117e6 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Fri, 25 Mar 2016 21:00:37 +0100 Subject: [PATCH] Fix listing of user group members in ACP --- .../lib/acp/form/UserSearchForm.class.php | 36 +++++++++++++++++-- .../condition/UserGroupCondition.class.php | 9 +++++ 2 files changed, 42 insertions(+), 3 deletions(-) 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() */ -- 2.20.1