Extension:AccessControl

From MediaWiki.org

Jump to: navigation, search
If you need per-page or partial page access restrictions, you are advised to install an appropriate content management package. MediaWiki was not written to provide per-page access restrictions, and almost all hacks or patches promising to add them will likely have flaws somewhere, which could lead to exposure of confidential data. We are not responsible for anything being leaked, leading to loss of funds or one's job.
For further details, see Security issues with authorization extensions


Manual on MediaWiki Extensions
List of MediaWiki Extensions
AccessControl

Release status: unknown

Implementation User rights, Tag
Description Extension to restrict access to specific pages based on internal groups or group lists from userspace.
Author(s) Aleš Kapica
Last Version 1.0
MediaWiki 1.11.0 and higher
License No license specified
Download from git repository http://support.dce.felk.cvut.cz/accesscontrol.git or http://support.dce.felk.cvut.cz/accesscontrol-1.0.tar.gz


This extension is based on original Extension:Group Based Access Control but without its bugs.

Unlike the original Extension:Group Based Access Control, double commas aren't used for selection group, only one comma is required. It is not necessary to use the ',,' separator at the end of the element content. It is also possible to use usergroups and internal groups MediaWiki at the same time.

Contents

[edit] Features

  • easy to setup and simple for using
  • no patches, real extension
  • as many groups as you want
  • access is controlled for viewing and edits the pages (also if you access it manually per action=edit in the URL)
  • for user groups lists it can use any namespaces, which may be protected by other extension, by its alone too (In original Group Based Access Control can be set special namespace "Usergroup:.." only in extension variable )
  • all users in the sysop-Group (the one from mediaWiki) can see and edit the protected pages, if it is allowed by extension variable )
  • access can be granted to multiple groups
  • you can use for controlling access any internal system groups from MediaWiki in parallel with user groups lists
  • read only access is also possible to be set, not only for groups, but for any user too
  • Unauthorized user can't use search feature to find pages protected by accesscontrol element

Please read about security issues with authorization extensions

[edit] Documentation

[edit] Installation

  • Step 1:
    • add the following lines to the bottom of your LocalSettings.php:
require_once("extensions/AccessControl.php");

NB : See discussion

  • Step 2:
    • check (and maybe edit) the settings in 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.
$wgUseMediaWikiGroups = false; // use the groups from MediaWiki instead of own Usergroup pages
$wgAdminCanReadAll = true; // sysop users can read all restricted pages
  • Step 3:
    • Create a Wiki-Page with users list in any namespace in ex. My:Group (this title is usergroup name) and add the users in the group in a bulletlist
    • Example: If you want a group "Department" in namespace IT with the users "John Doe" and "Jane Doe". Create the Wiki-Article "IT:Department" and put the following in its text:
*John Doe
*Jane Doe (ro)
User from a group, which have appended string "(ro)" to the name can only read protected Article, but can't edit it. For other group of users you can create memberlist with name Department too, but in other namespace.
Tips
To protect namespace IT you can use for example Extension:Lockdown, but you can use element accesscontrol to protect it itself.
  • Step 4:
    • In depends on localization your MediaWiki should be created pages to which anonymous or unauthorized users will be redirected. You have create them in advance, because to some of them isn't any access from other page.
    • The safety of the page provides accesscontrol element. And his content. If there isn't any or is empty the page is free accesible for logged users (they can read and edit page). No logged or annonymous user can only read the page.
    • Members from groups in accesscontrol element can edit page, only if the group title in list doesn't have added string "(ro)", or if they don't have set readonly access in their user grouplist.
    • If it is set the variable $wgUseMediaWikiGroups to true, you can use for managing access the internal groups from MediaWiki too.
    • If it is set the variable $wgAllowUserList to false, only members from 'sysop' group can edit usergroups pages in any namespace.
    • Example: <accesscontrol>Administrators,IT:Department,Sales(ro)</accesscontrol>
In this example all users from the groups "Administrators", "IT:Department" and "Sales" can read the page but only the users from "Administrators" MediaWiki group (if exists) and John Doe from "IT:Deparment" usergroup can edit it.

[edit] Usage

That is for the installation. To restrict access on a page for specific usergroups, just include the names of the allowed usergroups (separated by commas) as the content of accesscontrol tag in the body of that page. Thus, if you wanted to restrict access to the people with groups "Administrators", "IT:Department" and "Sales", you would use the following syntax:

<accesscontrol>Administrators,IT:Department,Sales (ro)</accesscontrol>

IT:Department is usergroup, and groups Administrators and Sales my be added by Extension:GroupPermissionsManager. Members from group Sales page can read only.

Tips
If it is set true $wgAccessControlMessages variable, the element accesscontrol is replaced by warning message.

[edit] Attention

  • Groups from MediaWiki must be in not localized form! In ex. 'sysop' not 'Správce' , etc.
  • On page may be more accesscontrol elements. Access is accepted for groups from all.tags
  • Anonymous user has not access on pages protected by accesscontrol elements
  • Pages without protection can anonymous user only read
  • Logged user has access on protected page only when he is member of any group with access rights on page
  • If is set in extension script variable $wgAdminCanReadAll on true, have members from group 'sysop' edit access on page allways

[edit] Example

See an example of this add-on in action at: http://support.dce.felk.cvut.cz/mediawiki/index.php/Git run by the author)


[edit] MediaWiki Version

  • Version 1.0 of this extension has been tested and works fine on MediaWiki versions > 1.12.x.

[edit] See also

Personal tools