From: Chad Horohoe Date: Mon, 4 Aug 2008 05:14:33 +0000 (+0000) Subject: Reimplement User::, now with less crappy name and only taking one permission at a... X-Git-Tag: 1.31.0-rc.0~46154 X-Git-Url: http://git.cyclocoop.org/clavettes/images/siteon3.jpg?a=commitdiff_plain;h=9a0dcbf44d2282e780028ed137392b8932d19068;p=lhc%2Fweb%2Fwiklou.git Reimplement User::, now with less crappy name and only taking one permission at a time. :) --- diff --git a/includes/User.php b/includes/User.php index 5c12981970..b2791b9f96 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2767,6 +2767,23 @@ class User { } return $rights; } + + /** + * Get all the groups who have a given permission + * + * @param $role String: Role to check + * @return array list of groups with the given permission + */ + static function getGroupsWithPermission( $role ) { + global $wgGroupPermissions; + $allowedGroups = array(); + foreach ( $wgGroupPermissions as $group => $rights ) { + if ( $rights[$role] === true ) { + $allowedGroups[] = $group; + } + } + return $allowedGroups; + } /** * @param $group String: key name