From 03ef70741df5a214736ec20783e1e61c704ca8ab Mon Sep 17 00:00:00 2001 From: Rob Church Date: Thu, 9 Aug 2007 16:36:15 +0000 Subject: [PATCH] * (bug 10859) Introduce 'UserGetImplicitGroups' hook; see docs/hooks.txt for more information * Move the list of implicit groups in User::getAllGroups() to a new User::getImplicitGroups() method so there's no confusion over where to add these --- RELEASE-NOTES | 2 ++ docs/hooks.txt | 3 +++ includes/User.php | 17 ++++++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 1ff18dd766..ccda196ad0 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -167,6 +167,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Show standard tool links for blocked users in Special:Ipblocklist * Miscellaneous aesthetic improvements to Special:Ipblocklist * (bug 10826) Added link trail with Cyrillic characters for Mongolian language +* (bug 10859) Introduce 'UserGetImplicitGroups' hook; see docs/hooks.txt for + more information == Bugfixes since 1.10 == diff --git a/docs/hooks.txt b/docs/hooks.txt index 55bca1ed85..b33a95131c 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -692,6 +692,9 @@ $article: article object watched $user: user that watched $article: article object that was watched +'UserGetImplicitGroups': Called in User::getImplicitGroups() +&$groups: List of implicit (automatically-assigned) groups + 'UserGetRights': Called in User::getRights() $user: User to get rights for &$rights: Current rights diff --git a/includes/User.php b/includes/User.php index 38fd5d0440..fb735e86d1 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2561,7 +2561,22 @@ class User { global $wgGroupPermissions; return array_diff( array_keys( $wgGroupPermissions ), - array( '*', 'user', 'autoconfirmed', 'emailconfirmed' ) ); + self::getImplicitGroups() + ); + } + + /** + * Get a list of implicit groups + * + * @return array + */ + public static function getImplicitGroups() { + static $groups = null; + if( !is_array( $groups ) ) { + $groups = array( '*', 'user', 'autoconfirmed', 'emailconfirmed' ); + wfRunHooks( 'UserGetImplicitGroups', array( &$groups ) ); + } + return $groups; } /** -- 2.20.1