Extension talk:DisallowAccessOnCategory
Add topicRemove this extension?
[edit]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
[edit]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))
- 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 !!!
[edit]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
[edit]Does this actually work?
- I untarred DisallowAccessOnCategory.php into /mediawiki/extensions
- added the following LocalSettings.php
#Activate ACL on Categories require_once ("$IP/extensions/DisallowAccessOnCategory.php"); ###security based on Category #define rights of "EERLSTAFF" $wgGroupPermissions['EERLSTAFF']['read'] = true; $wgGroupPermissions['EERLSTAFF']['edit'] = true; $wgGroupPermissions['EERLSTAFF']['createpage'] = true; $wgGroupPermissions['EERLSTAFF']['createtalk'] = true; $wgGroupPermissions['EERLSTAFF']['minoredit'] = true; # allow EERLSTAFF to use the pages of the "Protected" Category $wgGroupPermissions['EERLSTAFF']['protected'] = true;
- added a category to a page
[[Category:EERLSTAFF]] [[Category:Staff Council]]
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:
[[Category:Protected]]
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
###security based on Category #define rights of "architecture group" 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; # allow rchitecture group to use the pages of the "Protected" Category $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 */ ?>
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
[edit]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
[edit]The hook must return a Boolean value:
<?php //set up hook $wgExtensionFunctions[] = "wfDisallowReadOnCategory"; function wfDisallowReadOnCategory() { global $wgHooks; // use the userCan hook to check permissions $wgHooks[ 'userCan' ][] = 'DisallowReadOnCategory'; } /** DisallowReadOnCategory * @param $titlePage TitlePage * @param $user wgUser * @param $action string * @param $result boolean */ function DisallowReadOnCategory ( $titlePage, $user, $action, $result ) { global $wgContLang; $categoryNSText = $wgContLang->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 {