Extension talk:Hierarchical Namespace Permissions

User rights
The LocalSettings.php example contains rights (browse, raw, Leave_Comment_Form) not mentioned in Help:User rights. Where can I find the documentation for these rights? ThT 16:00, 27 September 2007 (UTC)
 * The code file actually contains lots of documentation. Jean-Lou Dupont 16:19, 27 September 2007 (UTC)
 * Before asking here I checked the code file as well. I couldn't find definitions of the rights browse, raw, Leave_Comment_Form there. ThT 06:06, 28 September 2007 (UTC)
 * The 'browse' right is one supported through the BizzWiki platform. The 'raw' right is available through RawRight. Jean-Lou Dupont 11:05, 28 September 2007 (UTC)

Only allow registered users access
I seem to be stuck at an dead-end.

I only want registered users to be able to access the wiki I'm building. However, this doesn't seem to allow for it. The only way I become able to log in is by setting the "read" to true. I could create a separate "read" just for NS_SPECIAL, but that give anonymous users access to the SpecialPages, which I don't want.

Do you have a recommendation?

// Implicit group for all visitors users $wgGroupPermissions['*']['createaccount']  = true;

$anonAllowedSpaces = array( NS_MEDIA, NS_MAIN, NS_TALK, NS_USER, NS_USER_TALK, NS_HELP, NS_HELP_TALK, NS_CATEGORY,NS_CATEGORY_TALK,NS_IMAGE ); foreach($anonAllowedSpaces as $ns) {       $wgGroupPermissions['*'][hnpClass::buildPermissionKey($ns,"~","createaccount")]   = true; $wgGroupPermissions['*'][hnpClass::buildPermissionKey($ns,"~","read")]  = false; $wgGroupPermissions['*'][hnpClass::buildPermissionKey($ns,"~","browse")] = false; $wgGroupPermissions['*'][hnpClass::buildPermissionKey($ns,"~","search")] = false; $wgGroupPermissions['*'][hnpClass::buildPermissionKey($ns,"~","viewsource")] = false; }

$wgGroupPermissions['*' ][hnpClass::buildPermissionKey("~","~","createaccount")]   = true;

I even attempted throwing in:

$wgWhitelistRead = array( ":Main_Page", "Special:Userlogin", "-", "MediaWiki:Monobook.css" );

But that failed too.

Almost forgot, using MW 1.11.

- Marc 09/28/07 5:55PM EST.
 * You need to add Special:Userlogin to the $wgGroupPermissions.
 * Lastly, I do not support 1.11... for now ;-) Jean-Lou Dupont 22:00, 28 September 2007 (UTC)


 * I spoke up too soon. But thank you.  I saw the last few lines of code you were using and I suddenly realized that the middle set of " " were to symbolize a page.  This did the trick:

$wgGroupPermissions['*'][hnpClass::buildPermissionKey(NS_SPECIAL,"Userlogin","read")] = true;


 * After logging in, it wanted me to go back to Special:Userlogin, which isn't that big of a deal. I'm sure I can either figure out the redirect afterward on my own, or not worry about it. The important thing is that it now works, for anyone else who wants to prevent anonymous users.


 * But that was actually my second issue. If you don't mind, I'll start a new topic since it's a different issue.

DB locking up
I hope I'm doing this right. In order to create a new page in a Namespace, I'm going Namespace:Pagename. When I do that, after I hit save, I end up locking up my database. I don't know if that's specific to 1.11, or something you're familiar with.

Warning: file_get_contents(/wiki/images/lock_yBgMBwiR) [function.file-get-contents]: failed to open stream: No such file or directory in /wiki/includes/OutputPage.php on line 1061 Database locked From TestWiki Jump to: navigation, search The database is currently locked to new entries and other modifications, probably for routine database maintenance, after which it will be back to normal.

The administrator who locked it offered this explanation:


 * - Marc 09/28/07 6:12PM EST
 * Never heard of such issue for 1.10. Sorry - I haven't tackled 1.11 yet. Jean-Lou Dupont 22:34, 28 September 2007 (UTC)


 * Well that's a bummer. Thanks anyway.  I guess I just need to wait or find another method.  Between this and Extension:UserRightsList, this seemed like the best way for me to do what I needed, which is to restrict different user groups to different namespaces.  I know it's not what the wiki was designed for, but I'm using it for internal documentation.


 * I did some additional investigation and perhaps this might help. The page I'm getting the error on, OutputPage.php, I did some work on it prior to installing your extension.  Specifically:

http://meta.wikimedia.org/wiki/Talk:Page_access_restriction_with_MediaWiki#Patching_MW_1.11


 * Do you think something there might've caused a conflict?
 * - Marc 8:03PM EST 10/01/07
 * Can't say for sure. If you really want better permission management, then why don't you try Extension:BizzWiki ? Jean-Lou Dupont 00:29, 2 October 2007 (UTC)

"Gr|{$num}|NsMng" Solution
After completely installing the extension, while using both User rights management and the User List extension, I kept getting multiple entries for:

"Gr|{$num}|NsMng"

In HierarchicalNamespacePermissions.php, on Line 144, I had to add:

return true;

142                if (!$hnpObjDebug) 143                        $wgHooks['userCan'][] = array( $this, 'userCan'         ); (+)144                return true; 145                $this->initGroups;

This fixed the issue. From everything I've seen, this is a common issue with MW 1.10 extensions. I'm using 1.11. Just thought I'd share. Still working on the DB issue. I might move into a different method instead.


 * - Marc 10/1/07
 * Thanks for insight into 1.11 Jean-Lou Dupont 17:06, 1 October 2007 (UTC)