Extension talk:GroupPermissionsManager

Archive 1

Association with Namespaces
I am not sure if I am going to ask the question correctly, but here I go.

I am about 3 months into using and setting up our wiki and each day we are expanding the requirements. We have been playing around with GroupPermissionManager for the past week and today we experimented with Lockdown and began to read up on HNP.

I really like this extension because of the GUI interface and how easy it is to use, but what do you use to associate the groups and permission you have assigned with namespaces? We are currently using namespaces to break up various areas of work assignments and our plan was to assign various groups (1 or more) to the namespaces to complete the work.

I have not exercised Lockdown extensively yet, but it seems to have what I might need except everything is defined in files on the server side (LocalSettings.php) and thus only I can access it and set it up.

I have not installed HNP yet, but atleast the information is held in a sub-page that someone other then me can edit.

So my real question is do you assign your groups to namespaces and if so do you have an extension you like.

--Wolcott 14:49 EST 03 July 2008


 * I will answer my own question by defining the following in LocalSettings.php
 * define ("NS_Test_OddAll", 1520);
 * $wgExtraNamespaces[NS_Test_OddAll] = "TstOddAll";
 * $wgNamespaceProtection[NS_Test_OddAll] = array('edit-tstoddall');


 * Then using Special:SortPermissions add edit-tstoddall permission and finally assign the permission to a group.
 * --Wolcott 16:42 EST 03 July 2008


 * A GUI method for doing something like this would be nice. Any plans for a future version of GPM? 192.73.45.37 13:55, 9 July 2008 (UTC)
 * Perhaps, depends on how hard it is to code or whether I get bored halfway through. -- Skiz zerz  14:41, 18 July 2008 (UTC)

Special:SortPermissions [Add Permission button]
After typing in a new permission and pressing the Add Permission button, nothing happens. --Wolcott 16:52 EST 03 July 2008
 * That was fixed in the latest version from Subversion (you might need to reload the page to see the change, though). -- Skiz zerz  22:43, 3 July 2008 (UTC)
 * Now fixed for IE as well :) -- Skiz zerz  02:01, 3 August 2008 (UTC)

SortPermission buttons
I downloaded 3.2.2 last Friday and have installed it on my office server and home computer. I have not been able to type in a new permission name 'edit-soccer', press the "Add Permission" button and have it be added to the list. Am I missing something? JavaScript is enabled.

When the "Save" button is pressed the config/SortPermission.php file is updated, but without the new permission. Wolcott 18:11, 22 July 2008 (UTC)
 * I cannot reproduce the specific issue you are having. When I add in a permission and click "Save", the permission is added to the listing in the appropriate place alphabetically on the Special:SortPermissions page and the config/SortPermissions.php file appears to be updated correctly. The only advice I can give is make sure that you click on one of the sort types after you add the permission, otherwise the data about the new permission won't be submitted when you save and as such, no new permission will be added. However, it seems that I can't assign that permission via Special:GroupPermissions... which I'm looking into right now. -- Skiz zerz  19:48, 22 July 2008 (UTC)
 * Question 1 - When the "Add Button" is pressed what code is being executed? When I press the button the screen does not flash or updated.
 * Question 2 - To make sure I have this correct (I know it is straight forward). You should type the new permission into the Add Permission text box and press the "Add Permission" button. I assume that should ass it to the above list.  Then you should select Sort Type toggle for the new permission and press save. --Wolcott 20:00, 22 July 2008 (UTC)
 * For #1, The code at /scripts/permsort.js is being executed. It should add another row to the bottom of the large list of permissions. Please note that it does not add in duplicate permissions, so if the permission you're trying to add is already in there, it won't add it again. Also, it requires javascript, so that must be enabled on your browser. I do not plan on making it work for browsers with javascript disabled, since site admins should have js on anyway. For #2, yes, that is the procedure. You may add/change/remove as many sort types and permissions as you want before pressing save. -- Skiz zerz  20:26, 22 July 2008 (UTC)
 * OK I found one thing. I would guess that you are running on Unix/Linux server.  I am running under MW 1.12 on a Windows server.  If I look at the html source for the Special:SortPermissions page it shows  .  The addScriptFile function checks if the first character of $file begins with a "/".  If so it leaves the passed in value alone, otherwise it adds {$wgStylePath}/common/ to the front and thus we end up with the above entry in the html source.  Not sure if I am missing a setting somewhere in my LocalSettings.php file but below is the code you are using to build the file path and name:

$dir = dirname(__FILE__); $pos = strpos($dir, $wgScriptPath); $inc = substr($dir, $pos); addScriptFile("$inc/scripts/permsort.js");


 * The results for me are:

echo $wgScriptPath.nl2br("\n"); /wiki echo $dir.nl2br("\n"); C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\wiki\extensions\GroupPermissionsManager echo $inc.nl2br("\n"); C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\wiki\extensions\GroupPermissionsManager


 * For the time being I will hard code the $file name and see what I get. I am off to ice skating and hockey camp for the boys.  Will repost in 4 hours.--Wolcott 12:18, 23 July 2008 (UTC)


 * Two ways to fix this for all operating systems might be to remove the building of $inc and pass the whole path. $wgScriptPath which is "/wiki" can not be found in "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\wiki\extensions\GroupPermissionsManager" because Windows is "\wiki" and not "/wiki".

addScriptFile($wgScriptPath."/extensions/GroupPermissionsManager/scripts/permsort.js");
 * 1) $dir = dirname(__FILE__);
 * 2) $pos = strpos($dir, $wgScriptPath);
 * 3) $inc = substr($dir, $pos);
 * 4) addScriptFile("$inc/scripts/permsort.js");


 * or just pass permsort.js and place the javascript in /wiki/skins/common directory. The addScriptFile function will append the correct path to the file.

addScriptFile("permsort.js");
 * 1) $dir = dirname(__FILE__);
 * 2) $pos = strpos($dir, $wgScriptPath);
 * 3) $inc = substr($dir, $pos);
 * 4) addScriptFile("$inc/scripts/permsort.js");


 * --Wolcott 18:39, 23 July 2008 (UTC)


 * What browser are you using? Once I fixed the pathing issue above it worked on Safari 3.1.2, Firefox 3.0.1, but did not work on Internet Explorer 7.0.7530.13.--Wolcott 19:20, 23 July 2008 (UTC)


 * Here is a URL that discusses IE 7.0 and dynamically appending a child to a table. I am not a JSCRIPT writer but I will try some stuff tonight/tomorrow.  I search for 'jscript appendChild IE 7'.
 * Example Issue - http://bytes.com/forum/thread820895.html
 * Example Solution - http://bytes.com/forum/thread799228.html


 * --Wolcott 20:35, 23 July 2008 (UTC)


 * Here is my mod to permsort.js
 * Changed function addRow table.appendChild(tr); to table.tBodies[0].appendChild(tr);
 * --Wolcott 01:13, 24 July 2008 (UTC)
 * I'll apply a fix for that in a few days... and curse at IE. -- Skiz zerz  17:28, 30 July 2008 (UTC)
 * Should be fixed now -- Skiz zerz  02:01, 3 August 2008 (UTC)

ExtendedPermissions Plugin
I am having an issue with the ExtendedPermissions plugin and a custom namespace that is protected. Either I am confused about the priority of setting permissions or the code is missing some logic. What is the reason for the ExtendedPermissions plugin? Here is my setup in the LocalSettings.php file:

define("NS_SOCCER", 5000); define("NS_SOCCER_TALK", 5001);

$wgExtraNamespaces = array(NS_SOCCER     => "Soccer",          NS_SOCCER_TALK => "Soccer_talk");

$wgContentNamespaces[] = NS_SOCCER;

$wgNamespacesWithSubpages[NS_SOCCER] = true;

$wgNamespaceProtection[NS_SOCCER] = array( 'edit-soccer' ); #Permission required to edit the namespace
 * 1) $wgGroupPermissions['sysop']['edit-soccer'] = true;       #Permission granted to users in the "sysop" group

Test Case 1 -
 * 1) Move the "ExtendedPermissions.php" file to the disabled directory (so that it is not used).
 * 2) Comment out $wgGroupPermissions so that the sysop group does not have the "edit-soccer" permission.
 * 3) Login as WikiSysop.
 * 4) Navigate to a page within the Soccer namespace
 * 5) Select the "View Source" tab (since the edit is not available).
 * 6) The source page is displayed and can't be edited or saved.

Test Case 2 -
 * 1) Leave the "ExtendedPermissions.php" file in the disabled directory (so that it is not used).
 * 2) Uncomment $wgGroupPermissions so that the sysop group has the "edit-soccer" permission.
 * 3) Login as WikiSysop.
 * 4) Navigate to a page within the Soccer namespace
 * 5) Select the "Edit" tab (since we now have the protected permission).
 * 6) The page is displayed and can be edited or saved.

Test Case 3 -
 * 1) Move the "ExtendedPermissions.php" file back into the plugins directory (so that it is used).
 * 2) Comment out $wgGroupPermissions so that the sysop group does not have the "edit-soccer" permission.
 * 3) Login as WikiSysop.
 * 4) Navigate to a page within the Soccer namespace
 * 5) Select the "View Source" tab (since the edit is not available).
 * 6) The source page is displayed and can be edited or saved. WRONG!!!

I believe that the line "} elseif( !$title->isTalkPage && $user->isAllowed('edit') ) {" in the function efGPManagerExtendedPermissionsGrant (which is the userCan hook) is not checking if the namespace is protected and has the correct edit permission.

What are your thoughts?

--Wolcott 23:00, 24 July 2008 (UTC)


 * A test for isNamespaceProtected took care of Test Case 3 above. Looks like the test needs to be performed in other parts of the ExtendedPermissions.php code, I will try to get to it this weekend.

if( $title->isTalkPage && $user->isAllowed('edittalk') ) { $result = true; return false; } elseif( !$title->isTalkPage && $user->isAllowed('edit') ) { if (!$title->isNamespaceProtected) { $result = true; return false; } }

--Wolcott 12:47, 25 July 2008 (UTC)
 * That would kind-of work, but not really. If the namespace is protected, even if the person is able to edit it, it would prevent them from doing so. I'll apply a fix for this in a few days, along with the permsort update. -- Skiz zerz  17:30, 30 July 2008 (UTC)
 * Should be fixed now. Let me know if it isn't -- Skiz zerz  02:01, 3 August 2008 (UTC)
 * Version 3.2.3 has an error with the namespace protection. There were a few other bugs I noticed (such as the versionCheck function being incorrect and the CustomToolbox plugin not working at all), so I'm bugfixing those as well before I release 3.2.4. -- Skiz zerz  22:33, 8 August 2008 (UTC)
 * 3.2.4 is out and fixes this bug properly as well as a few others. -- Skiz zerz  23:32, 12 August 2008 (UTC)

Adding extra permissions - Semantic Form's 'edit with form' tab
Hello. I'm want to use version 3.2.2 of GroupPermissionsManager along with the Semantic Forms extension. Semantic Forms has an extra tab called "edit with form". When I enable GroupPermissionsManager, this tab disappears (not very surprising!). How can I add 'edit with forms' to the list of permissions to allow control? I realise it will be a code change. Thanks! --Mitchelln 15:18, 25 July 2008 (UTC).
 * I just found the same thing this morning. I am currently looking at the CustomTabs.php plugin to understand the code logic. --Wolcott 14:54, 25 July 2008 (UTC)
 * You can disable both plugins by moving the files (CustomTabs.php, ExtenededPermissions.php) to the disabled directory. You will loose some lower fidelity permissions (thus the edit permission controls createPage, viewSource) I think, but the basics will still work until the code can be enhanced.--Wolcott 22:38, 25 July 2008 (UTC)
 * Thanks for the fast response. I can do without the fine permissions for now. The basics seem to work fine :-) --Mitchelln 14:19, 28 July 2008 (UTC).
 * I know why that's happening, should be a minor fix. There's nothing wrong with the ExtendedPermissions plugin regarding this, just that CustomTabs wasn't re-running the hook that Semantic Forms used. -- Skiz zerz  17:34, 30 July 2008 (UTC)
 * Thanks for the response. I will be at a conference early next week but will run the above fixes through our site and let you know the results.  Great extension.--Wolcott 21:47, 30 July 2008 (UTC)
 * This also has been fixed -- Skiz zerz  02:01, 3 August 2008 (UTC)

Syntax error in 1.3
just installed this extension Not sure which setting is causing the problem, but i am now getting Line:2 Char:1 Syntax error Code:0 on all pages, and all the javascript stuff is no longer working, i did add $wgAllowUserJs = true; in my locaksettings.php, and all errors goes away if i delete GroupPermissions.php. Whats wrong with it? --Zzzztz 19:43, 15 August 2008 (UTC)
 * Please provide more information, such as what version of MediaWiki you are using, what version of the extension you installed, and which file is giving that error. -- Skiz zerz  21:54, 15 August 2008 (UTC)
 * Nvm, found the problem just had to set "raw" to true, and it disappeared. --Zzzztz 23:14, 15 August 2008 (UTC)

Remove Unused Groups leads to site homepage.
Whenever an admin clicks on the Remove Unused Groups special page, they get brought back to the site's homepage (www.site.com). I quickly looked at the code, but I didn't see anything that would be causing this behavior, but I could have missed something. If it matters, the wiki is installed in site.com/wiki. Thanks. 192.73.45.37 11:58, 29 August 2008 (UTC)
 * Works for me. Please provide additional info, such as:
 * Version of MediaWiki
 * Version of GroupPermissionsManager
 * What your $wgScriptPath and $wgArticlePath are set to in LocalSettings.php
 * What other extensions you have installed
 * What hacks (if any) were made to the core MediaWiki files
 * -- Skiz zerz  13:02, 29 August 2008 (UTC)


 * Here is the data:
 * 1.13.0
 * Version 3.2.4
 * $wgScriptPath = "/wiki"; and I could not find $wgArticlePath in LocalSettings.php
 * ContactPage r37418, Contributors 1.0.1beta, SpecialInterwiki r37451, Cite r37577, Pdf Book 0.0.12, Simple Calendar 1.2.4, Custom Tabs 1.1, Custom Toolbox 1.1, Extended Permissions 1.2, Newuserlog r36653
 * No hacks to core MW files
 * ThomasOwens 13:31, 29 August 2008 (UTC)
 * This has been resolved on IRC. There was no issue with the extension itself, but rather a separate script that this person had running was preventing access to the special page. -- Skiz zerz  21:30, 30 August 2008 (UTC)

Permission to see article diffs and old versions
If you disable the history for any reasons you probably want to disable the diff view and old versions too (Which are still possible to see by using the URL you get from the watch-mail for example).

You may add this to the efGPManagerExtendedPermissionsRevoke function:

if( ($wgRequest->getVal('diff', null) != null) && !$user->isAllowed('history') ) { $result = $err; return false; } if( ($wgRequest->getVal('oldid', null) != null) && !$user->isAllowed('history') ) { $result = $err; return false; }

I am not sure if it's the best solution, but it works for me. Regards --Benjamin Garn 09:03, 2 September 2008 (UTC)
 * Good point, I'll add it in later, maybe not quite that way though (might be a separate permission, for example). -- Skiz zerz  21:49, 2 September 2008 (UTC)