From 9a0dcbf44d2282e780028ed137392b8932d19068 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Mon, 4 Aug 2008 05:14:33 +0000 Subject: [PATCH] Reimplement User::, now with less crappy name and only taking one permission at a time. :) --- includes/User.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 -- 2.20.1