From 4f1a4872a79ac4dab31f1783ba5ccc970b164392 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 27 Mar 2019 17:41:08 +0100 Subject: [PATCH] Incorrect scoping for user group searches See WoltLab/com.woltlab.wbb#325 --- .../install/files/lib/data/user/UserAction.class.php | 8 +++++++- .../files/lib/data/user/group/UserGroup.class.php | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/data/user/UserAction.class.php b/wcfsetup/install/files/lib/data/user/UserAction.class.php index fe67f7ad93..d863d33249 100644 --- a/wcfsetup/install/files/lib/data/user/UserAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserAction.class.php @@ -512,7 +512,13 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio $list = []; if ($this->parameters['data']['includeUserGroups']) { - $accessibleGroups = UserGroup::getMentionableGroups(); + if ($this->parameters['data']['scope'] === 'mention') { + $accessibleGroups = UserGroup::getMentionableGroups(); + } + else { + $accessibleGroups = UserGroup::getAllGroups(); + } + foreach ($accessibleGroups as $group) { if (!empty($this->parameters['data']['restrictUserGroupIDs']) && !in_array($group->groupID, $this->parameters['data']['restrictUserGroupIDs'])) { continue; diff --git a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php index 81db49c650..abf5f314c6 100644 --- a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php +++ b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php @@ -442,4 +442,14 @@ class UserGroup extends DatabaseObject implements ITitledObject { return $groups; } + + /** + * @return UserGroup[] + * @since 5.2 + */ + public static function getAllGroups() { + self::getCache(); + + return self::$cache['groups']; + } } -- 2.20.1