From: Alexander Ebert Date: Mon, 15 Apr 2019 17:14:40 +0000 (+0200) Subject: Merge branch 'next' into next-owner-group X-Git-Tag: 5.2.0_Alpha_1~136^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3290ae8e378761aeffd4c1613595626b5f48dbed;p=GitHub%2FWoltLab%2FWCF.git Merge branch 'next' into next-owner-group --- 3290ae8e378761aeffd4c1613595626b5f48dbed diff --cc wcfsetup/install/files/lib/data/user/group/UserGroup.class.php index 256173c5c0,4d50d20927..18ed85b24a --- a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php +++ b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php @@@ -259,12 -238,27 +259,30 @@@ class UserGroup extends DatabaseObject return $groups; } + /** + * Returns a sorted list of accessible groups. - * ++ *v + * @param integer[] $groupTypes + * @param integer[] $invalidGroupTypes + * @return UserGroup[] + * @since 5.2 + */ + public static function getSortedAccessibleGroups(array $groupTypes = [], array $invalidGroupTypes = []) { + $userGroups = self::getAccessibleGroups($groupTypes, $invalidGroupTypes); + + uasort($userGroups, function(UserGroup $groupA, UserGroup $groupB) { + return strcasecmp($groupA->getName(), $groupB->getName()); + }); + + return $userGroups; + } + /** - * Returns true if the current group is an admin-group. - * Every group that may access EVERY group is an admin-group. + * Returns true if the current group is an admin-group, which requires it to fulfill + * one of these conditions: + * a) The WCFSetup is running and the group id is 4. + * b) This is the 'Owner' group. + * c) The group can access all groups (the 'Owner' group does not count). * * @return boolean */