* badaccess/badaccesstext to supercede sysop*, developer* messages
* Changed $wgGroupPermissions to more cut-n-paste-friendly format
* 'developer' group deprecated by default
+* Special:Upload now uses 'upload' permission instead of hardcoding login check
+* Add 'importupload' permission to disable direct uploads to Special:Import
=== Caveats ===
$wgGroupPermissions['user' ]['move'] = true;
$wgGroupPermissions['user' ]['read'] = true;
+$wgGroupPermissions['user' ]['upload'] = true;
$wgGroupPermissions['bot' ]['bot'] = true;
$wgGroupPermissions['sysop']['delete'] = true;
$wgGroupPermissions['sysop']['editinterface'] = true;
$wgGroupPermissions['sysop']['import'] = true;
-$wgGroupPermissions['sysop']['importraw'] = true;
+$wgGroupPermissions['sysop']['importupload'] = true;
+$wgGroupPermissions['user' ]['move'] = true;
$wgGroupPermissions['sysop']['patrol'] = true;
$wgGroupPermissions['sysop']['protect'] = true;
$wgGroupPermissions['sysop']['rollback'] = true;
+$wgGroupPermissions['user' ]['upload'] = true;
$wgGroupPermissions['bureaucrat']['userrights'] = true;
/**
* List of interwiki prefixes for wikis we'll accept as sources for
- * Special:Import (for sysops). Since complete page history# can be imported,
+ * Special:Import (for sysops). Since complete page history can be imported,
* these should be 'trusted'.
+ *
+ * If a user has the 'import' permission but not the 'importupload' permission,
+ * they will only be able to run imports through this transwiki interface.
*/
$wgImportSources = array();
* Constructor
*/
function wfSpecialImport( $page = '' ) {
- global $wgOut, $wgLang, $wgRequest, $wgTitle;
+ global $wgUser, $wgOut, $wgLang, $wgRequest, $wgTitle;
global $wgImportSources;
###
switch( $wgRequest->getVal( "source" ) ) {
case "upload":
- $result = $importer->setupFromUpload( "xmlimport" );
+ if( $wgUser->isAllowed( 'importupload' ) ) {
+ $result = $importer->setupFromUpload( "xmlimport" );
+ } else {
+ return $wgOut->permissionRequired( 'importupload' );
+ }
break;
case "interwiki":
$result = $importer->setupFromInterwiki(
}
}
- $wgOut->addWikiText( "<p>" . wfMsg( "importtext" ) . "</p>" );
$action = $wgTitle->escapeLocalUrl( 'action=submit' );
- $wgOut->addHTML( "
+
+ if( $wgUser->isAllowed( 'importupload' ) ) {
+ $wgOut->addWikiText( "<p>" . wfMsg( "importtext" ) . "</p>" );
+ $wgOut->addHTML( "
<fieldset>
<legend>Upload XML</legend>
<form enctype='multipart/form-data' method='post' action=\"$action\">
</form>
</fieldset>
" );
-
+ } else {
+ if( empty( $wgImportSources ) ) {
+ $wgOut->addWikiText( wfMsg( 'importnosources' ) );
+ }
+ }
+
if( !empty( $wgImportSources ) ) {
$wgOut->addHTML( "
<fieldset>
}
/** Various rights checks */
- if( ( $wgUser->isAnon() )
- OR $wgUser->isBlocked() ) {
+ if( !$wgUser->isAllowed( 'upload' ) || $wgUser->isBlocked() ) {
$wgOut->errorpage( 'uploadnologin', 'uploadnologintext' );
return;
}
'importnotext' => 'Empty or no text',
'importsuccess' => 'Import succeeded!',
'importhistoryconflict' => 'Conflicting history revision exists (may have imported this page before)',
+'importnosources' => 'No transwiki import sources have been defined and direct history uploads are disabled.',
# Keyboard access keys for power users
'accesskey-search' => 'f',