Index: trunk/phase3/includes/User.php |
— | — | @@ -2767,6 +2767,23 @@ |
2768 | 2768 | } |
2769 | 2769 | return $rights; |
2770 | 2770 | } |
| 2771 | + |
| 2772 | + /** |
| 2773 | + * Get all the groups who have a given permission |
| 2774 | + * |
| 2775 | + * @param $role String: Role to check |
| 2776 | + * @return array list of groups with the given permission |
| 2777 | + */ |
| 2778 | + static function getGroupsWithPermission( $role ) { |
| 2779 | + global $wgGroupPermissions; |
| 2780 | + $allowedGroups = array(); |
| 2781 | + foreach ( $wgGroupPermissions as $group => $rights ) { |
| 2782 | + if ( $rights[$role] === true ) { |
| 2783 | + $allowedGroups[] = $group; |
| 2784 | + } |
| 2785 | + } |
| 2786 | + return $allowedGroups; |
| 2787 | + } |
2771 | 2788 | |
2772 | 2789 | /** |
2773 | 2790 | * @param $group String: key name |