X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/includes/specials/SpecialListgrants.php diff --git a/includes/specials/SpecialListgrants.php b/includes/specials/SpecialListgrants.php new file mode 100644 index 00000000..1a04eec4 --- /dev/null +++ b/includes/specials/SpecialListgrants.php @@ -0,0 +1,91 @@ +setHeaders(); + $this->outputHeader(); + + $out = $this->getOutput(); + $out->addModuleStyles( 'mediawiki.special' ); + + $out->addHTML( + \Html::openElement( 'table', + [ 'class' => 'wikitable mw-listgrouprights-table' ] ) . + '' . + \Html::element( 'th', null, $this->msg( 'listgrants-grant' )->text() ) . + \Html::element( 'th', null, $this->msg( 'listgrants-rights' )->text() ) . + '' + ); + + foreach ( $this->getConfig()->get( 'GrantPermissions' ) as $grant => $rights ) { + $descs = []; + $rights = array_filter( $rights ); // remove ones with 'false' + foreach ( $rights as $permission => $granted ) { + $descs[] = $this->msg( + 'listgrouprights-right-display', + \User::getRightDescription( $permission ), + '' . $permission . '' + )->parse(); + } + if ( !count( $descs ) ) { + $grantCellHtml = ''; + } else { + sort( $descs ); + $grantCellHtml = ''; + } + + $id = Sanitizer::escapeIdForAttribute( $grant ); + $out->addHTML( \Html::rawElement( 'tr', [ 'id' => $id ], + "" . + $this->msg( + "listgrants-grant-display", + \User::getGrantName( $grant ), + "" . $id . "" + )->parse() . + "" . + "" . $grantCellHtml . "" + ) ); + } + + $out->addHTML( \Html::closeElement( 'table' ) ); + } + + protected function getGroupName() { + return 'users'; + } +}