[Mediawiki-l] Restricting write access for a custom namespace to asingle group

Isaac Guenard izyk at eyeonline.com
Fri Jul 7 19:58:30 UTC 2006


A progress report. I attempted to modify the code from the Preventing_Access page to suit my needs, and ended up with the following

function userCanEdit() {
	global $wgUser;
	$result = null;
	wfRunHooks( 'userCan', array( &$this, &$wgUser, 'edit', &$result ) );
	if ( $result !== null ) {
		return $result;
	}
			
	if( $wgUser->isAllowed('edit') ) { 
		if( $this->getNamespace() == 100 ) {
			if( $wgUser->isAllowed('viewforbidden') ) {
				return true;
			} else {
	            	        return false;
			}
		}
	} else {
		return false;
	}
}


While this does not generate an error, in testing it on pages in my main namespace, it seems all pages become Protected. 

I have no idea what wfRunHooks does, so I guess that’s what I need to look at next....


 
Thanks

Isaac Guenard
Sr. Product Manager - eyeon Software
 
web   : www.eyeonline.com
email : izyk at eyeonline.com
phone : 416 686-8411 x300

-----Original Message-----
From: mediawiki-l-bounces at Wikimedia.org [mailto:mediawiki-l-bounces at Wikimedia.org] On Behalf Of Isaac Guenard
Sent: Friday, July 07, 2006 2:48 PM
To: mediawiki-l at Wikimedia.org
Subject: [Mediawiki-l] Restricting write access for a custom namespace to asingle group

Hello

I am searching the archives for an answer at the moment, but it’s a pretty long task, so I thought I would post the question while I searched in case anyone had an answer.

In http://meta.wikimedia.org/wiki/Preventing_Access there is an excellent section detailing how to restrict read access for a custom namespace to a single group. I am attempting to modify the same approach so that I can restrict edit access instead.

The idea is that we intend to operate a public wiki, but a small portion of the content is to be set aside to host the official product documentation. I want this custom namespace to only permit edit access to members of a custom group.

At first glance, it seems I need to edit Title.php and modify the userCanEdit() function, but my initial attempts generate some pretty gnarly errors. My PHP skills are VERY novice level, and I have only been using Wikipedia for a week, so I feel a bit like a bull in a fine china shop.

Can anyone provide a hint or some pointers?
 
Thanks

Isaac Guenard
Sr. Product Manager - eyeon Software
 
web   : www.eyeonline.com
email : izyk at eyeonline.com
phone : 416 686-8411 x300

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.9/382 - Release Date: 7/4/2006
 
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l at Wikimedia.org
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.9/382 - Release Date: 7/4/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.9/382 - Release Date: 7/4/2006
 



More information about the MediaWiki-l mailing list