Last modified: 2011-04-14 15:10:43 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T26324, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 24324 - Allow to disable all actions and allow specific ones
Allow to disable all actions and allow specific ones
Status: NEW
Product: MediaWiki
Classification: Unclassified
Page protection (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-10 01:39 UTC by bertou
Modified: 2011-04-14 15:10 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description bertou 2010-07-10 01:39:03 UTC
In addition to the current opt-out of wgDisabledActions, it would be nice to be able to disable all actions and only allow some of them. For example, if one disables "edit", one also has to remember to disable "editredlink", etc.
A very simple implementation is to modify in include/Wiki.php:
 if( in_array( $action, $this->getVal( 'DisabledActions', array() ) ) ) {
to:
 if( in_array( $action, $this->getVal( 'DisabledActions', array() ) ) || ( in_array( '*', $this->getVal( 'DisabledActions', array() ) ) && !  in_array( $action, $this->getVal( 'EnabledActions', array() ) ))) {
and add a
$mediaWiki->setVal( 'EnabledActions', $wgEnabledActions );
to index.php
One could therefore disable all actions by setting:  $wgDisabledActions = array('*');
and then allow some: $wgEnabledActions = array('view');

One nice application is for those using mediawiki as a webpage for non registered users (I know, it is not made for it, but this modification is really minor), as one can have in LocalSettings.php:
$wgHooks['MediaWikiPerformAction'][] = 'fnEditingForRegisteredUsersOnly';
function fnEditingForRegisteredUsersOnly( $output, $article, $title, $user, $request, $wiki ) {
    global $wgDisabledActions,$wgEnabledActions;
    if(!$user->isLoggedIn()) {
        $wgDisabledActions = array('*');
        $wgEnabledActions = array('view');
    }
    return true;
}
and only allow the view action to visitors.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links