Hello, I am new to the list - I have a question I hope you can help me with.
I have installed a wiki where users cannot sign up themselves (I assign usernames) I want to restrict users on my installation to only editing specific sections of the wiki. I think the file to edit is includes\EditPage.php
I want it to work so that if a person's username contains a colon (e.g. FOO:Bob) then they can only edit and create pages that are in the form FOO:Page_Name, FOO:Main_Page etc. I want it to treat users with usernames that don't contain a colon normally. E.g.
1) Someone with the username FOO:Bob can edit FOO:Page_Name but not BAR:Main_Page.
2) Someone with the username Bob can edit FOO:Page_Name and BAR:Main_Page and Main_Page
I'm happy for this edit to take the form of an edit converting "you must login to edit this page" to "you must login and have the right permissions to edit this page". I think that EditPage.php would need to be edited twice in the areas containing the text:
if ( !$wgUser->getID() && $wgWhitelistEdit ) { $this->userNotLoggedInPage(); return; }
I have sought an answer to this question for a while and posted in various other forua without success.
Hope you can help.
Many thanks,
Robert Jones
On Nov 4, 2004, at 9:19 AM, Robert Jones wrote:
I want it to work so that if a person's username contains a colon (e.g. FOO:Bob) then they can only edit and create pages that are in the form FOO:Page_Name, FOO:Main_Page etc. I want it to treat users with usernames that don't contain a colon normally. E.g.
You need to edit Title.php, Title::userCanEdit().
-- brion vibber (brion @ pobox.com)
Thank you for pointing me the this section. I am a novice, so could you please explain which bits of this section need to be edited and how so that users with a colon in their username can only edit pages that begin in the same way as their username?
Many thanks.
On Nov 4, 2004, at 9:19 AM, Robert Jones wrote:
I want it to work so that if a person's username contains a colon (e.g. FOO:Bob) then they can only edit and create pages that are
in the form
FOO:Page_Name, FOO:Main_Page etc. I want it to treat users with usernames that don't contain a colon normally.
You need to edit Title.php, Title::userCanEdit().
-- brion vibber (brion @ pobox.com)
On Thursday 04 November 2004 19:19, Robert Jones wrote:
usernames) I want to restrict users on my installation to only editing specific sections of the wiki.
You might want to check the Wikka Wakka Wiki software that http://www.openformats.org uses.
I'm afraid I can't access the site you mention as it is "not responding". I also think that changing the software is a bit of an extreme solution (I'd rather just find out how to edit mediawiki). Sorry for being a pain.
-----Original Message----- From: wikitech-l-bounces@wikimedia.org [mailto:wikitech-l-bounces@wikimedia.org] On Behalf Of NSK Sent: 04 November 2004 20:30 To: Wikimedia developers Subject: Re: [Wikitech-l] Editing mediawiki so only certain users can editcertain pages
On Thursday 04 November 2004 19:19, Robert Jones wrote:
usernames) I want to restrict users on my installation to
only editing
specific sections of the wiki.
You might want to check the Wikka Wakka Wiki software that http://www.openformats.org uses.
Clarification:
Basically I want to prohibit editing in two circumstances, and deal with whether it is allowed or not it as per the normal rules other circumstances.
1) if the username contains a colon AND the page name doesn't contain a colon then editing is prohibited. 2) if the username contains a colon AND the page name contains a colon AND the text before each colon doesn't match then editing is prohibited. 3) otherwise the existing rules apply.
I'm trying to do this by editing includes/Title.php
Many thanks.
If anyone can solve this, I'll happily pay. I've posted it as a question in Google Answers and would buy something of similar value on someone's (e.g.) Amazon wish list if it was answered elsewhere. Thanks for your help thus far, I will also continue to try to solve it myself.
http://answers.google.com/answers/threadview?id=421607
Regards.
-----Original Message----- From: wikitech-l-bounces@wikimedia.org [mailto:wikitech-l-bounces@wikimedia.org] On Behalf Of Robert Jones Sent: 04 November 2004 21:06 To: 'Wikimedia developers' Subject: RE: [Wikitech-l] Editing mediawiki so only certain users can editcertain pages
Clarification:
Basically I want to prohibit editing in two circumstances, and deal with whether it is allowed or not it as per the normal rules other circumstances.
- if the username contains a colon AND the page name doesn't
contain a colon then editing is prohibited. 2) if the username contains a colon AND the page name contains a colon AND the text before each colon doesn't match then editing is prohibited. 3) otherwise the existing rules apply.
I'm trying to do this by editing includes/Title.php
Many thanks.
On Thursday 04 November 2004 22:51, Robert Jones wrote:
I'm afraid I can't access the site you mention as it is "not responding".
Strange, it shouldn't be. Can you access it now?
Perhaps you can use the Wikka ACL (access control lists) code in MediaWiki to do what you want.
Does anyone know if MediaWiki will add ACL-based control on pages and media in the future? Is this slated for an upcoming release?
Andreas
On Nov 4, 2004, at 3:30 PM, NSK wrote:
On Thursday 04 November 2004 19:19, Robert Jones wrote:
usernames) I want to restrict users on my installation to only editing specific sections of the wiki.
You might want to check the Wikka Wakka Wiki software that http://www.openformats.org uses.
-- NSK Admin of http://portal.wikinerds.org Project Manager of http://www.nerdypc.org Project Manager of http://www.adapedia.org _______________________________________________ Wikitech-l mailing list Wikitech-l@wikimedia.org http://mail.wikipedia.org/mailman/listinfo/wikitech-l
After a lot of testing, I eventually solved the problem by adding these four lines to "function userCanEdit()" in "includes/Title.php"
It's a bit messy and I think the "i"s are not necessary, but I hope this is of use to someone.
if ( preg_match("/:/i",$wgUser->getName()) and !preg_match("/:/i",$this->mDbkeyform) ) { return false; } $pageprefixtext = preg_split("/:/i",$this->mDbkeyform); $userprefixtext = preg_split("/:/i",$wgUser->getName()); if ( preg_match("/:/i",$wgUser->getName()) and preg_match("/:/i",$this->mDbkeyform) and $pageprefixtext[0] != $userprefixtext[0] ) { return false; }
wikitech-l@lists.wikimedia.org