https://bugzilla.wikimedia.org/show_bug.cgi?id=24324

           Summary: Allow to disable all actions and allow specific ones
           Product: MediaWiki
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Normal
         Component: Page protection
        AssignedTo: [email protected]
        ReportedBy: [email protected]


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.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to