Windows Ninja
Windows Ninja

Reputation: 259

How Can I Set Permissions for Individual Wiki Pages?

There are few pages on our wiki that I'd like to be able to protect from editing by people other than the assigned owner of that page.

We're currently running MediaWiki v1.15.4 and are unable to update to 1.18 for the time being.

Thanks in advance.

Edit: Just to clarify, the permissions need to be set for individual users and not by groups.

Upvotes: 1

Views: 266

Answers (1)

Jens Nyman
Jens Nyman

Reputation: 1216

I had a similar problem where I needed more flexibility than the default system offered. I solved this by this script (embedded in a mediawiki extension):

// check each page for gossip permissions
$wgHooks['ArticlePageDataBefore'][] = 'GossipProtection_check_permissions';

/**
 * ArticlePageDataBefore hook
 * 
 * $article: article that is requested
 * ($fields: not important)
 */
function GossipProtection_check_permissions($article, $fields) {
    global $wgUser;
    $title = $article->getTitle()->mTextform;
    if(is_gossip_page($title))
        if(!this_user_is_allowed_on_page($title))
            die('You are not allowed on this page');
    return true;
}

But using mediawiki's protection service is off course more elegant. You could for example create a group for the allowed users.

Upvotes: 1

Related Questions