Extension talk:DisallowAccessOnCategory

Remove this extension?
Hi, I am the original author of this extension, but haven't maintained it since my last edit to the main page (we had a policy change and no longer needed the extension). I'd be happy to remove this extension, since its badly tested (or was, I don't know how well the new version is tested). If somebody else wants to pick up development of that extension, I am happy to provide a git repository to it. If you are happy with this page the way it is, you can also just leave it here, of coures ;-) -- Mati 20:09, 26 February 2011 (UTC)

Version Incompatibility
I tried to install this extension using wikimedia 1.11.0. After placing the .php file in the extensions folder and making the appropriate changes in the LocalSettings.php I tried to run the wiki and received th following error:

Internal error

Detected bug in an extension! Hook DisallowReadOnCategory failed to return a value; should return true to continue hook processing or false to abort.

Backtrace:


 * 0 C:\Inetpub\wwwroot\wikis\TNMS4Wiki\includes\Title.php(1264): wfRunHooks('userCan', Array)
 * 1 C:\Inetpub\wwwroot\wikis\TNMS4Wiki\includes\Wiki.php(133): Title->userCanRead
 * 2 C:\Inetpub\wwwroot\wikis\TNMS4Wiki\includes\Wiki.php(43): MediaWiki->preliminaryChecks(Object(Title), Object(StubObject), Object(WebRequest))
 * 3 C:\Inetpub\wwwroot\wikis\TNMS4Wiki\index.php(89): MediaWiki->initialize(Object(Title), Object(StubObject), Object(User), Object(WebRequest))
 * 1) 4 {main}

Does anyone know if the DisallowAccessOnCategory extension has been tested with wikimedia 1.11.0? Has anyone experienced this error or found a fix? I would greatly appreciate some feedback! Thanks.

Download not working !!!
Please correct it, or paste the extension-source-code. Thanks

Unfortunatly the text of the introduction still moves over that Extensions-Box. If anyone knows the cause for this please, fix it for me :-)

Troubleshooting
Does this actually work? require_once ("$IP/extensions/DisallowAccessOnCategory.php");
 * I untarred DisallowAccessOnCategory.php into /mediawiki/extensions
 * added the following LocalSettings.php
 * 1) Activate ACL on Categories

$wgGroupPermissions['EERLSTAFF']['read'] = true; $wgGroupPermissions['EERLSTAFF']['edit'] = true; $wgGroupPermissions['EERLSTAFF']['createpage'] = true; $wgGroupPermissions['EERLSTAFF']['createtalk'] = true; $wgGroupPermissions['EERLSTAFF']['minoredit'] = true; $wgGroupPermissions['EERLSTAFF']['protected'] = true;
 * 1) security based on Category
 * 2) define rights of "EERLSTAFF"
 * 1) allow EERLSTAFF to use the pages of the "Protected" Category


 * added a category to a page

But things aren't working. Any authenticated user can see the page-- not just someone assigned to the EERLSTAFF group.

Using mediawiki 1.9.3

I have never used this extension but in reading the page i believe what they are trying to explain is that you use the "protected" category not the group name. Try this and see if it works:
 * -- Suki 09:29, 12 April 2007 (UTC)

You should add $wgGroupPermissions['*']['your category'] = false;    /* <-- prevents anonymous users from seeing the pages */ $wgGroupPermissions['user']['your category'] = false; /* <-- prevents logged in users from seeing the pages */

I just tried and it functions very well.

--Julian 20:36, 26 April 2007 (UTC)

I also having issues getting this to work. Hopefully someone can help. I am on MW1.8.2. I have added the following to localsettings.php

require_once ("$IP/extensions/DisallowAccessOnCategory.php"); $wgGroupPermissions['architecture']['read'] = true; $wgGroupPermissions['architecture']['edit'] = true; $wgGroupPermissions['architecture']['createpage'] = true; $wgGroupPermissions['architecture']['createtalk'] = true; $wgGroupPermissions['architecture']['minoredit'] = true; $wgGroupPermissions['architecture']['protected'] = true; $wgGroupPermissions['*']['protected'] = false;    /* <-- prevents anonymous users from seeing the pages */ $wgGroupPermissions['user']['protected'] = false; /* <-- prevents logged in users from seeing the pages */ ?>
 * 1) security based on Category
 * 2) define rights of "architecture group"
 * 1) allow rchitecture group to use the pages of the "Protected" Category

Same problem as above - any authenticated user can see the page-- not just someone assigned to the architecture group I created. Any ideas?

Thanks

Sean.mcclowry 13:04, 18 May 2007 (UTC)

Version numbering / date format
Please please please (et cetera) don't abort the otherwise excellent ISO 8601 date standard with this weird YYYY-DD-MM thing in the version numbering scheme.

The existing ludicrous MM-DD-YYYY format makes the ISO8601 format particularly appealing, but its strength lies in large part on the fact that no one (yet, and hopefully ever) uses any date format that has a similar structure.

Jedd 01:50, 9 October 2007 (UTC)

Fixed Version for MediaWiki 1.12.0
The hook must return a Boolean value:

getNSText ( NS_CATEGORY ); $categories = $titlePage->getParentCategories; $result = true;        /* default */ if ( is_array( $categories ) && array_key_exists("$categoryNSText:Protected", $categories) ) {          if ( $user->isAllowed("$action") && $user->isAllowed('protected') ) $result = true; else $result = false; }        return false; } ?>

If you use a public wiki (wgGroupPermissions['*']['read'])) then you also need to fix MediaWiki 1.12.0 source (backport from trunk):

diff -ur mediawiki-1.12.orig/includes/Title.php mediawiki-1.12.0/includes/Title.php --- mediawiki-1.12.orig/includes/Title.php    2008-04-24 16:06:37.000000000 +0200 +++ mediawiki-1.12.0/includes/Title.php       2008-04-25 14:57:26.000000000 +0200 @@ -1383,16 +1383,16 @@       public function userCanRead { global $wgUser, $wgGroupPermissions; -             # Shortcut for public wikis, allows skipping quite a bit of code path -             if ($wgGroupPermissions['*']['read']) -                     return true; -               $result = null; wfRunHooks( 'userCan', array( &$this, &$wgUser, 'read', &$result ) ); if ( $result !== null ) { return $result; } +             # Shortcut for public wikis, allows skipping quite a bit of code +             if ($wgGroupPermissions['*']['read']) +                     return true; +               if( $wgUser->isAllowed( 'read' ) ) { return true; } else {