Wow. It was a stupid PHP typo. All working now. Sorry for all the text on this, hopefully it helps someone else in the future.
The code that finally worked was ------------------
function userCanEdit() { /* return $this->userCan('edit'); */ global $wgUser; if( $wgUser->isAllowed('edit') ) { if( $this->getNamespace() == 100 ) { if( $wgUser->isAllowed('viewforbidden') ) { return true; } else { return false; } } else { return true; } } else { return false; } } ---------------
Can anyone think of any reason why this would be a bad idea?
Thanks
Isaac Guenard Sr. Product Manager - eyeon Software
web : www.eyeonline.com email : izyk@eyeonline.com phone : 416 686-8411 x300
-----Original Message----- From: mediawiki-l-bounces@Wikimedia.org [mailto:mediawiki-l-bounces@Wikimedia.org] On Behalf Of Isaac Guenard Sent: Friday, July 07, 2006 3:59 PM To: MediaWiki announcements and site admin list Subject: Re: [Mediawiki-l] Restricting write access for a custom namespaceto asingle group
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@eyeonline.com phone : 416 686-8411 x300
-----Original Message----- From: mediawiki-l-bounces@Wikimedia.org [mailto:mediawiki-l-bounces@Wikimedia.org] On Behalf Of Isaac Guenard Sent: Friday, July 07, 2006 2:48 PM To: mediawiki-l@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@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@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
_______________________________________________ MediaWiki-l mailing list MediaWiki-l@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
mediawiki-l@lists.wikimedia.org