Extension:Group Based Access Control

From MediaWiki.org
Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
Crystal Clear action run.png
Group Based AccessControl

Release status: unknown

Implementation User rights, Tag
Description Extension to restrict access to specific pages based on groups.
Author(s) Martin Gondermann
Last Version 0.8 (http://blog.pagansoft.de)
MediaWiki 1.11.0 and higher
License No license specified
Download here

check usage (experimental)

Contents

[edit] Features

[edit] Caveats

Please read about security issues with authorization extensions

[edit] Documentation

[edit] Installation

require_once("extensions/accesscontrolSettings.php");
include("extensions/accesscontrol.php");
$wgAccessControlDisableMessages = false; // if false, show a Line on Top of each secured Page, which says, which Groups are allowed to see this page.
$wgAccessControlGroupPrefix = "Usergroup"; // The Prefix for the Usergroup-Pages
$wgAccessControlNoAccessPage = $wgScriptPath . "/index.php/No_Access"; // To this Page will these users redirected who are not allowed to see the page.
$wgWikiVersion = 1.6; // Set this to 1.7, if you use mediaWiki 1.7 or greater, this is for compatibility reasons
$wgUseMediaWikiGroups = false; // use the groups from MediaWiki instead of own Usergroup pages
$wgAdminCanReadAll = true; // sysop users can read all restricted pages
$wgGroupLineText = "This page is only accessible for group %s !!!"; // The text for the showing on the restricted pages, for one group
$wgGroupsLineText = "This page is only accessible for group %s !!!"; // The text for the showing on the restricted pages, for more than one group
$wgAccesscontrolDebug = false;	// Debug log on
$wgAccesscontrolDebugFile = "/var/www/wiki/config/debug.txt"; // Path to the debug log
*John Doe
*Jane Doe

There is a second possibility for using groups. You can set the variable $wgUseMediaWikiGroups to true and use the internal groups from MediaWiki. Then you can use the special page "Special:Userrights" for Useradministration and you don't have to create the Usergroup pages.

[edit] Usage

That's it for the installation. To restrict access on a page-by-page basis to specific usergroups, just include the names of the allowed usergroups within a tag (separated by double commas) in the body of that page. Thus, if you wanted to restrict access to the people with usergroups "Administrators", "IT-Department" and "Sales", you would use the following syntax:

 <accesscontrol>Administrators,,IT-Department,,Sales</accesscontrol>

[edit] Naming

This extension is referenced by three different names:

[edit] Example

See an example of this add-on in action at: Cubic Path Wiki (Note: this link doesn't work) run by the author of the AIM extension)

[edit] Tips

[edit] Version 0.7

Version 0.7 of the extension does not work with MediaWiki 1.9


It works with mediawiki 1.9.3 (that's my solution for working, not more..) [1]

Important Info:

<accesscontrol>Administrators,,IT-Department,,Sales,,</accesscontrol>

Use for the last group also a ",," at the end (see above)

(With only one group it works without the ",," at the end)

[edit] Custom urls

By default the extension links to /index.php/Page, for example for the group links. If you've customized your mediawiki to listen to a different url scheme, you have to find the following line in accesscontrol.php:

 // return the HTML link
 return "<a href=\"/index.php/$linkTitle\" title=\"$linkTitle\">$linkName</a>";

Change 'index.php' to the links that your wiki is using.

[edit] See also

Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Toolbox