|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
Release status: stable
|Implementation||User rights, Tag|
|Description||Allows to restrict access to specific pages based on internal groups or group lists from userspace|
|Author(s)||Aleš Kapica (Wanttalk)|
|Latest version||2.5 tested on 1.23.5 (2014-08-25)|
|MediaWiki||mediawiki 1.21 >= accesscontrol 2.5 (recomended)
mediawiki 1.18+ - 1.20.x = accesscontrol v. 2.1 (unsupported)
mediawiki 1.16 <= accesscontrol 1.3 (unsupported)
|Example||http://support.dce.felk.cvut.cz/mediawiki/index.php/Support or https://www.thewoodcraft.org/wiki/index.php/thewoodcraft.org|
Translate the AccessControl extension if it is available at translatewiki.net
|Check usage and version matrix; code metrics|
|Open tasks · Report a bug|
The AccessControl extension allows to restrict access to specific pages based on internal groups or group lists from userspace.
- 1 Rationale
- 2 How this extension meets the requirements for site security?
- 3 Features
- 4 Documentation
- 5 Attention
- 6 Example
- 7 MediaWiki Version
- 8 See also
- 9 Notes
Rationale[edit | edit source]
MediaWiki in default state is not designed as a Content Management System (CMS), but when used as a corporate or school intranet it is required to protect sensitive data. AccessControl has been developed for this purpose.
How this extension meets the requirements for site security?[edit | edit source]
|Warning:||It is recommended to use last stable version of MediaWiki, because older versions of MediaWiki can be bypassed by different methods!|
- Atom/RSS feeds & Diff & revision links
- Page content is protected, but when opening a page from history, a piece of raw content will appear in this. If tag "accesscontrol" was placed at the beginning, a potential attacker may be able to obtain information about names of contributing users!
- Listings & search
- Unless otherwise noted, if there is any page with protected content in search results, the user is redirected away. Since version of extension 2.5, searching may be allowed too. But it should be borne in mind that the displayed search results can compromise sensitive data. Therefore, do not write to your wiki such sensitive information as password, that could be obtained throught a fulltext searching, if is allowed search in contents of pages protected through a AccessControl!
- Inclusion/transclusion & related rights and other extensions
- Page containing the AccessControl tag or includes another page protected by the AccessControl tag, is secure. Tag AccessControl is searched in raw wiki code - before conversion to HTML.
|Warning:||When using the DynamicPageList (third-party), you must know that this extension does selection from content page before the parser analyzes wiki code. Protection of generated pages by a AccessControl tag depends only on the facts if the tag is included into the content of new page.|
- The problem with redirection was repaired in version 1.1
- API and action links
- For each anonymous user the action class is automatically set to false, besides view attribute for unprotected pages. Allowed actions for the authorized user depends on the permissions settings of mediawiki and his username listed in the access list which pages will use.
- Edit Section and Watching Pages
- Options are available only to registered user. If user is logged and member from the security access list.
- Files & Images
- WARNING: The extension AccessControl does not protect files against direct access via URL! If files can not be publicly available, must be protect at the server level!
- XML export (Special page Export)
- WARNING: AccessControl version < 2.0, was based on the hook, which was not protected from MediaWiki side before exporting in a raw form code the page. Therefore, if you use version AccessControl < 2.0, you must prohibit the special page for export the pages from MediaWiki.
- Author backdoor
- Extension AccessControl have not any backdoor!
- I recommend to turn off caching. See the previous paragraphs
More info about potential problems regarding security is on page Security issues with authorization extensions.
Features[edit | edit source]
- Easy to setup and simple to use.
- No patches, real extension.
- Unlimited number of groups.
- Dual mode access control:
- View control.
- Edit control, including restrictions on manual edit access when using action=edit in the URL.
- User groups may use any namespace.
- Namespaces with group lists may be protected by another extension.
- MediaWiki sysop-Group may view and edit the protected pages.
- Controlled by extension variable
- Controlled by extension variable
- Access may be granted to multiple groups
- Read only access may be granted to both groups and individual users.
- Unauthorized users can use search feature only if is it allowed. See How this extension meets the requirements for site security?.
Documentation[edit | edit source]
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/AccessControl.git
Installation[edit | edit source]
Step 1: Local Settings File[edit | edit source]
- add the following lines to the bottom of your LocalSettings.php:
- add a namespace to the LocalSettings.php file for the purpose of creating groups.
- See Manual:Using_custom_namespaces for more information.
NB : See discussion
- Check (and maybe edit) the settings in AccessControl.php:
$wgAdminCanReadAll = true; // sysop users can read all restricted pages $wgAccessControlRedirect = false; // don't redirect from page with search results for denied and // annonymous users, if searching pattern is validate on any // protected page.
Step 2: Create User Groups[edit | edit source]
User groups are simply standard wiki pages that are part of a namespace other than the default namespace. For ease of use, it is suggested that a specific custom namespace be created for the explicit purpose of managing access control list pages.
- Create a Wiki-Page with a users list in any namespace
- It is not sufficient to simply create a page with a colon (:) in the name, this extension requires the use of a namespace and one or more pages within namespaces
- Page Name Example: My:Group
- The namespace is My
- The group page is Group
- This is the name of usergroup
- Users are added to the group in a bulletlist
- Page Content Example
- Presume that the namespace IT exists
- Create a page in the namespace titled "Department"
- Create users "John Doe" and "Jane Doe" in the group. The group information is contained on the page "Department".
- Each user name appears as a list item.
*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.
- To protect namespace IT you can use for example Extension:Lockdown, but you can use element accesscontrol to protect it itself.
Step 3: Additional Access Control[edit | edit source]
- It depends on localization, your MediaWiki needs pages created to which anonymous or unauthorized users will be redirected. You have create them in advance, because some of them can't access pages from another page.
- The safety of the page provides accesscontrol element. And his content. If there isn't any or is empty the page is free accessible 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.
- By default the variable
$wgAdminCanReadAllis set to true - members from 'sysop' group can edit usergroups pages in any namespace.
|Warning:||When set to false - members from sysop can't read and edit pages protected with the AccessControl tag, which may lead to big trouble. Must be resolved on code level.|
- Example tag code
In this example all users from the groups "Administrators", "IT:Department" and "Sales" can read the page but only the users from "Administrators" group (if exists) and John Doe from "IT:Deparment" usergroup can edit it.
Usage on Pages to Control Access[edit | edit source]
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 top of the content page.
Attention[edit | edit source]
|MediaWiki version:||≥ 1.21|
Version 2.5 is strongly recommended to be used.
For version < 2.3[edit | edit source]
- There was problem in function fromTemplate(), it caused that the extension AccessControl did not accept tags from included pages or templates. Actualization is recommend!
For version >= 2.0[edit | edit source]
|1.18 – 1.20|
|Warning:||From version 2.0 extension not use groups from wiki (without sysop), only groups created by users access lists!|
- On page may be accepted only one accesscontrol elements.
- If the user is a member of multiple groups, so that takes precedence, which gives greater rights him.
- MediaWiki before 1.21 This extension uses a mediawiki hook that is called whenever a search result is displayed. This means that a page that has an ACL will trigger an "Access Denied" message for end users who happen to search for text contained in a protected page. A simple solution is to put pages that require AccessControl into another NameSpace and then disable searching for that NameSpace. All though this isn't really a bug, it is undesirable behavior. Click here for an example showing a work around.
|Warning:||Mediawiki >= 1.21 contains new framework ContentHandler and this extension version 2.1 is unusable. Use AccessControl version 2.2 which is updated for mediawiki 1.21 and above.|
For version <= 1.3[edit | edit source]
|MediaWiki version:||≤ 1.17|
- 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
$wgAdminCanReadAllon true, have members from group 'sysop' edit access on page always
Example[edit | edit source]
See an example of this add-on in action at: http://support.dce.felk.cvut.cz/mediawiki/index.php/Support run by the author)
Unfortunately the main page does not have an English version, which make it difficult to see the extension in action (for English speakers).
MediaWiki Version[edit | edit source]
- Version 2.5 was tested on MediaWiki version 1.22.9 (from git repository)
- Version 2.3 was tested on MediaWiki version 1.22.0 (from git repository)
- Version 2.2 was tested on MediaWiki version 1.22.0 (from git repository)
- Version 2.0 was tested on MediaWiki version 1.19-alpha (from svn repository)
- Version 1.2 was tested on MediaWiki version 1.15.5-1 (from Debian repository)
- Version 1.1 was tested on MediaWiki version 1.16.0(b3). Works fine, except that it needed a minor change to line 358 of AccessControl.php (remove '&' from parameter to function controlEditAccess() ). When viewing a page on a Linux server, the <accesscontrol> tags show. But on a Windows server, the tags don't show and it is fine! Still haven't figured that one out, but it is ok for my application.
- Version 1.1 was tested on MediaWiki version 1.15
- Version 1.0 of this extension has been tested and works fine on MediaWiki versions > 1.12.x.
- Version 1.1 tested on MediaWiki version 1.16.1 with new patch from http://git.felk.cvut.cz/pub/git?p=accesscontrol.git;a=commitdiff;h=2f678deed0e4e4f77620e391c94559c7b50102a9
See also[edit | edit source]
- Extension:Improved Access Control
- Extension:Page access restriction
- AccessControl extension read only feature error
- Manual:Preventing access
Notes[edit | edit source]
- Unlike the Extension:Group Based Access Control double commas aren't used to split the content of accesscontrol tag, when more access lists are used. Only one comma is required. And is not necessary to use the ',,' separator at the end of the element content.
- As of version 2.0, it only works with ACLs stored in namespace (Main). It also can only protect pages that are in namespace (Main). Changes need to be made to getUsersFromPages and getContentPage to correct the behavior. Click here to see a patched version of the extension that is compatible with NameSpaces.