From: Alexander Ebert Date: Wed, 27 Mar 2019 16:41:08 +0000 (+0100) Subject: Incorrect scoping for user group searches X-Git-Tag: 5.2.0_Alpha_1~176^2~12 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4f1a4872a79ac4dab31f1783ba5ccc970b164392;p=GitHub%2FWoltLab%2FWCF.git Incorrect scoping for user group searches See WoltLab/com.woltlab.wbb#325 --- 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']; + } }