From: Raimond Spekking Date: Thu, 10 Apr 2008 10:10:07 +0000 (+0000) Subject: * (bug 13604) Add Special:ListGroupRights to show a list of defined usergroups and... X-Git-Tag: 1.31.0-rc.0~48467 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=6d1f1f8d70b75963a45920323881b7e644b1facb;p=lhc%2Fweb%2Fwiklou.git * (bug 13604) Add Special:ListGroupRights to show a list of defined usergroups and the rights for these groups. See bug 13603 for the same function added to the API last week Patch by Mormegil --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0882f98861..808adf4d86 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -64,7 +64,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Redesign of Special:Userrights * Make rev_deleted log entries more intelligible. * (bug 6943) Added PAGESINCATEGORY: magic word - +* (bug 13604) Added Special:ListGroupRights === Bug fixes in 1.13 === diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 0aa929a99d..8eecb77a0a 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -234,6 +234,7 @@ function __autoload($className) { 'SkinTemplate' => 'includes/SkinTemplate.php', 'SpecialAllpages' => 'includes/SpecialAllpages.php', 'SpecialBookSources' => 'includes/SpecialBooksources.php', + 'SpecialListGroupRights' => 'includes/SpecialListgrouprights.php', 'SpecialMostlinkedtemplates' => 'includes/SpecialMostlinkedtemplates.php', 'SpecialPage' => 'includes/SpecialPage.php', 'SpecialPrefixindex' => 'includes/SpecialPrefixindex.php', diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 5cd275f9bc..9e941351f1 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1342,7 +1342,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches don't keep obsolete copies of global * styles. */ -$wgStyleVersion = '132'; +$wgStyleVersion = '133'; # Server-side caching: diff --git a/includes/SpecialListgrouprights.php b/includes/SpecialListgrouprights.php new file mode 100644 index 0000000000..bf3ae92f0a --- /dev/null +++ b/includes/SpecialListgrouprights.php @@ -0,0 +1,83 @@ + + */ +class SpecialListGroupRights extends SpecialPage { + + var $skin; + + /** + * Constructor + */ + function __construct() { + global $wgUser; + parent::__construct( 'Listgrouprights' ); + $this->skin = $wgUser->getSkin(); + } + + /** + * Show the special page + */ + public function execute( $par ) { + global $wgOut, $wgGroupPermissions, $wgImplicitGroups; + + $this->setHeaders(); + $this->outputHeader(); + + $wgOut->addHTML( + Xml::openElement( 'table', array( 'class' => 'mw-listgrouprights-table' ) ) . + '' . + Xml::element( 'th', null, wfMsg( 'listgrouprights-group' ) ) . + Xml::element( 'th', null, wfMsg( 'listgrouprights-rights' ) ) . + '' + ); + + foreach( $wgGroupPermissions as $group => $permissions ) { + $groupname = htmlspecialchars( $group ); + if ( in_array( $group, $wgImplicitGroups ) ) + $grouplink = $groupname; + else + $grouplink = $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Listusers' ), $groupname, 'group=' . $group ); + + $wgOut->addHTML( + ' + ' . + $grouplink . + ' + ' . + SpecialListGroupRights::formatPermissions( $permissions ) . + ' + ' + ); + } + $wgOut->addHTML( + Xml::closeElement( 'table' ) . "\n" + ); + } + + /** + * Create a user-readable list of permissions from the given array. + * + * @param $permissions Array of permission => bool (from $wgGroupPermissions items) + * @return string List of all granted permissions, separated by comma separator + */ + private static function formatPermissions( $permissions ) { + global $wgUser; + $r = array(); + foreach( $permissions as $permission => $granted ) { + if ( $granted ) { + $permission = htmlspecialchars( $permission ); + $r[] = wfMsgExt( 'listgrouprights-link', array( 'parseinline' ), $permission ); + } + } + sort( $r ); + $r = implode( wfMsg( 'comma-separator' ), $r ); + + return $r; + } +} diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 8a157eb1f3..ea891c8690 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -85,6 +85,7 @@ class SpecialPage 'Imagelist' => array( 'SpecialPage', 'Imagelist' ), 'Newimages' => array( 'IncludableSpecialPage', 'Newimages' ), 'Listusers' => array( 'SpecialPage', 'Listusers' ), + 'Listgrouprights' => 'SpecialListGroupRights', 'Statistics' => array( 'SpecialPage', 'Statistics' ), 'Randompage' => 'Randompage', 'Lonelypages' => array( 'SpecialPage', 'Lonelypages' ), diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 11a7a079a7..f5253c9082 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -363,6 +363,7 @@ $specialPageAliases = array( 'Imagelist' => array( 'ImageList' ), 'Newimages' => array( 'NewImages' ), 'Listusers' => array( 'ListUsers', 'UserList' ), + 'Listgrouprights' => array( 'ListGroupRights' ), 'Statistics' => array( 'Statistics' ), 'Randompage' => array( 'Random', 'RandomPage' ), 'Lonelypages' => array( 'LonelyPages', 'OrphanedPages' ), @@ -1876,6 +1877,13 @@ It may contain one or more characters which cannot be used in titles.', 'listusers-submit' => 'Show', 'listusers-noresult' => 'No user found.', +# Special:Listgrouprights +'listgrouprights' => 'User group rights', +'listgrouprights-summary' => 'The following is a list of user groups defined on this wiki, with their associated access rights.', +'listgrouprights-group' => 'Group', +'listgrouprights-rights' => 'Rights', +'listgrouprights-link' => "[[{{ns:help}}:Group rights#$1|$1]]", + # E-mail user 'mailnologin' => 'No send address', 'mailnologintext' => 'You must be [[Special:Userlogin|logged in]] and have a valid e-mail address in your [[Special:Preferences|preferences]] to send e-mail to other users.', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 1f9e364616..03516f9a9d 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1208,6 +1208,13 @@ $wgMessageStructure = array( 'listusers-submit', 'listusers-noresult', ), + 'listgrouprights' => array( + 'listgrouprights', + 'listgrouprights-summary', + 'listgrouprights-group', + 'listgrouprights-rights', + 'listgrouprights-link', + ), 'emailuser' => array( 'mailnologin', 'mailnologintext', @@ -2513,6 +2520,7 @@ XHTML id names.", 'logpages' => 'Special:Log', 'allpages' => 'Special:Allpages', 'listusers' => 'Special:Listusers', + 'listgrouprights' => 'Special:Listgrouprights', 'emailuser' => 'E-mail user', 'watchlist' => 'Watchlist', 'watching' => 'Displayed when you click the "watch" button and it is in the process of watching', diff --git a/skins/common/shared.css b/skins/common/shared.css index dba01a94c8..66bc5619c6 100644 --- a/skins/common/shared.css +++ b/skins/common/shared.css @@ -122,3 +122,17 @@ table.mw-userrights-groups * td,table.mw-userrights-groups * th { background-color: #f9f9f9; border: 1px dashed #aaa; } + +table.mw-listgrouprights-table { + border: 1px solid #ccc; + border-collapse: collapse; +} + +table.mw-listgrouprights-table tr { + vertical-align: top; +} + +table.mw-listgrouprights-table td, table.mw-listgrouprights-table th { + padding: 0.5em 0.2em 0.5em 0.2em; + border: 1px solid #ccc; +}