[Mediawiki-l] Blacklist pages from viewing?

Brion Vibber brion at pobox.com
Wed Aug 4 18:37:57 UTC 2004


Tor Bjornrud wrote:
>> Are there ways to do one of the following?
>>
>>     * Namespace the default set of documents and whitelist them, while 
>> creating a different namespace for the private pages?
>>     * Manage a blacklist of pages? Or blacklist a namespace?

There is not currently a blacklist feature, but it should be easy to 
hack in. In Title.php there is this function:

	function userCanRead() {
		global $wgUser;
		global $wgWhitelistRead;
		
		if( 0 != $wgUser->getID() ) return true;
		if( !is_array( $wgWhitelistRead ) ) return true;
		
		$name = $this->getPrefixedText();
		if( in_array( $name, $wgWhitelistRead ) ) return true;
		
		# Compatibility with old settings
		if( $this->getNamespace() == NS_MAIN ) {
			if( in_array( ":" . $name, $wgWhitelistRead ) ) 	
				return true;
		}
		return false;
	}

A blacklist will be the opposite of the whitelist:

	if( in_array( $name, $wgBlacklistRead ) ) return false;

Or a namespace blacklist might look like:

	if( in_array( $this->getNamespace(), $wgBlacklistNs ) ) {
		return false;
	}

However be careful; MediaWiki is designed for open access, and there may 
be numerous ways around the poorly tested, little-used access control 
features. I would not recommend relying on them for any purpose; if you 
have information you wish to keep private, the best way is to keep it 
completely separate from a public wiki database and use HTTP 
authentication to control access at the highest level.

-- brion vibber (brion @ pobox.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : http://lists.wikimedia.org/pipermail/mediawiki-l/attachments/20040804/867791df/attachment.pgp 


More information about the MediaWiki-l mailing list