MediaWiki  REL1_24
PermissionsError.php
Go to the documentation of this file.
00001 <?php
00028 class PermissionsError extends ErrorPageError {
00029     public $permission, $errors;
00030 
00031     public function __construct( $permission, $errors = array() ) {
00032         global $wgLang;
00033 
00034         $this->permission = $permission;
00035 
00036         if ( !count( $errors ) ) {
00037             $groups = array_map(
00038                 array( 'User', 'makeGroupLinkWiki' ),
00039                 User::getGroupsWithPermission( $this->permission )
00040             );
00041 
00042             if ( $groups ) {
00043                 $errors[] = array( 'badaccess-groups', $wgLang->commaList( $groups ), count( $groups ) );
00044             } else {
00045                 $errors[] = array( 'badaccess-group0' );
00046             }
00047         }
00048 
00049         $this->errors = $errors;
00050     }
00051 
00052     public function report() {
00053         global $wgOut;
00054 
00055         $wgOut->showPermissionsErrorPage( $this->errors, $this->permission );
00056         $wgOut->output();
00057     }
00058 }