Rozšíření:PageOwnership
MediaWiki nebyla navržena tak, aby podporovala omezení přístupu pro jednotlivé stránky nebo jejich části. Pokud tuto úroveň kontroly požadujete, důrazně doporučujeme používat systém správy obsahu, který ji nativně podporuje.
Záplaty nebo rozšíření třetích stran, která tvrdí, že poskytují kontrolu přístupu, mohou obsahovat bezpečnostní chyby, které by mohly vyzradit důvěrná data. Používejte je na vlastní nebezpečí. Ani vývojáři MediaWiki, ani Wikimedia Foundation nenesou odpovědnost za jakékoli úniky dat, které by mohly vzniknout. Tato zpráva se přidává ke všem rozšířením tohoto druhu a nemusí odrážet skutečný stav zabezpečení daného rozšíření. Více informací najdete na stránce Bezpečnostní problémy s autorizačními rozšířeními. |
PageOwnership je správce oprávnění, pomocí kterého mohou správci systému a oprávnění uživatelé přidělovat více vrstev oprávnění konkrétním uživatelům nebo skupinám, buď na úrovni stránky a jmenného prostoru, nebo pro celou wiki prostřednictvím uživatelsky přívětivého rozhraní. Podporuje Transkluze, mezipaměť a Semantic MediaWiki.
Počínaje verzí 1.1.0 PageOwnership důsledně podporuje všechna oprávnění a práva dostupná v MediaWiki prostřednictvím uživatelsky přívětivého rozhraní a již se nespoléhá na libovolná oprávnění bez přísné shody v modelu oprávnění/práv MediaWiki!
Instalace
- Stáhněte soubor/y a vložte je do adresáře pojmenovaného
PageOwnershipve vaší složceextensions/.
Vývojáři a přispěvatelé kódu by si místo toho měli nainstalovat rozšíření from Git pomocí:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/PageOwnership
- Na konec vašeho souboru LocalSettings.php přidejte následující kód:
wfLoadExtension( 'PageOwnership' );
- Spusťte aktualizační skript, který automaticky provede všechny nezbytné databázové změny, jaké rozšíření vyžaduje.
Dokončeno – Přejděte na stránku Special:Version vaší wiki a zkontrolujte, zda bylo rozšíření úspěšně nainstalováno.
Funkce
PageOwnership umožňuje přiřadit více sad nebo vrstev práv konkrétním uživatelům a skupinám, a to s ohledem na celou wiki nebo na základě konkrétních stránek, podstránek a jmenných prostorů. To umožňuje vyhovět prakticky jakékoli potřebě zamezení přístupu, od pouhého použití PageOwnership jako rozhraní pro správu oprávnění a práv Mediawiki tradičním způsobem až po přiřazení konkrétních stránek a jejich podstránek konkrétním uživatelům a skupinám, přičemž jiným skupinám uživatelů zabráníte v přístupu k nim nebo je upravovat.
PageOwnership díky své flexibilitě také umožňuje vynutit implicitní moderování na vaší wiki. You don't directly moderate pages (or page versions) like in FlaggedRevs or Approved Revs, instead, you assign a page and its sub-pages to authorized user(s) or group(s) which can edit them. Když je stránka připravena k publikování, buď k ní udělíte přístup všem, nebo editorům stránky poskytnete další práva související s danou stránkou a podstránkami (aby k ní mohli následně poskytnout přístup dalším uživatelům nebo skupinám).
Správa oprávnění
Správce oprávnění PageOwnership je přístupný z libovolného článku wiki, prostřednictvím navigační nabídky zobrazené výše nebo ze seznamu speciálních stránek.
Správce oprávnění se skládá ze dvou různých speciálních stránek (nebo z technického hlediska "kroků“" v rámci jedné jedinečné speciální stránky), první se všemi sadami oprávnění vztahujících se k celé wiki (pokud byl Správce oprávnění přístupný ze seznamu speciálních stránek) nebo k související stránce (libovolného jmenného prostoru) – a druhá uvádí specifická práva a oprávnění přiřazená konkrétním uživatelům nebo skupinám.
Zde je navigační seznam oprávnění přiřazených k "testovací stránce" a tlačítko "Přidat oprávnění", pomocí kterého můžete přidat novou sadu oprávnění.
První položka přiřazuje uživateli "Account test 1" oprávnění typu "Čtení" a "Úpravy" a dále specifická další práva poskytovaná vlastnictvím stránky, která rozšiřují daná práva i na podstránky související stránky, a odebírá právo zahrnuté ve standardní sadě oprávnění "Úpravy" ("Přesun stránek").
Druhý záznam shoduje se všemi anonymními a registrovanými uživateli a nepřiřazuje jim žádná práva. Tímto způsobem je všem anonymním i registrovaným uživatelům zabráněno v přístupu a úpravách "Testovací stránky" a jakékoli z jejích podstránek.
Also note that the rights associated to "Reading" and "Editing" permissions types are not arbitrary but reflect the table provided at Příručka:Uživatelská práva. Úplný přehled naleznete v tabulce níže.
Nastavení oprávnění
Z navigačního seznamu oprávnění na speciální stránce Spravovat oprávnění (známé také jako "pager") můžete přistupovat k formuláři pro nastavení oprávnění přidružených k libovolnému uživateli, skupině, stránce a jmennému prostoru pomocí tlačítka "Přidat oprávnění" nebo "Upravit" vedle každé existující sady oprávnění. Zde je:
Prostřednictvím prvního vstupu můžete zadat uživatele i skupiny a prostřednictvím druhého vstupu (vlastní OOUI "widget s více přepínacími tlačítky") můžete danému uživateli a skupině přiřadit sadu práv rozdělených podle typu. Jak již bylo zmíněno výše, tyto typy nejsou libovolné, ale odrážejí tabulku uvedenou na stránce Příručka:Uživatelská práva, která je následující:
| typ oprávnění | související práva |
|---|---|
| Čtení | read
|
| Editing | applychangetags, autocreateaccount, createaccount, createpage, createtalk, delete-redirect, edit, editsemiprotected, editprotected, minoredit, move, move-categorypages, move-rootuserpages, move-subpages, movefile, reupload, reupload-own, reupload-shared, sendemail, upload, upload_by_url
|
| Management | bigdelete, block, blockemail, browsearchive, changetags, delete, deletedhistory, deletedtext, deletelogentry, deleterevision, editcontentmodel, editinterface, editmyoptions, editmyprivateinfo, editmyusercss, editmyuserjs, editmyuserjsredirect, editmyuserjson, editmywatchlist, editsitecss, editsitejs, editsitejson, editusercss, edituserjs, edituserjson, hideuser, markbotedits, mergehistory, pagelang, patrol, patrolmarks, protect, rollback, suppressionlog, suppressrevision, unblockself, undelete, userrights, userrights-interwiki, viewmyprivateinfo, viewmywatchlist, viewsuppressed
|
| Administration | autopatrol, deletechangetags, import, importupload, managechangetags, siteadmin, unwatchedpages
|
| Technical | apihighlimits, autoconfirmed, bot, ipblock-exempt, nominornewtalk, noratelimit, override-export-depth, purge, suppressredirect, writeapi
|
Also note that because this subdivision does not reflect the rights assigned by default to each user (for instance the editprotected right is reserved to sysop by default, and obviously the createaccount right does not apply to the user group), in future version of the extension an additional subdivision per group, as in the table Manual:User_rights#List_of_groups, might be added, while currently you can add/remove rights through the additional inputs "Add/remove specific permissions".
Položka "Další práva" obsahuje všechna dostupná práva, která nejsou zahrnuta ve výše uvedeném rozdělení, konkrétně práva poskytovaná rozšířeními.
Nakonec, vstupy "Přidat specifická oprávnění" a „"Odebrat specifická oprávnění" s použitím přepínače OOUI's MenuTagMultiselectWidget umožňují přidávat/odebírat specifická oprávnění k/z popsaných typů oprávnění a automaticky se vyplňují v závislosti na vybraných typech, takže máte přesnou představu o skutečně přiřazených právech.
Currently, as for the version 1.1.0 PageOwnership, by contrast to previous versions, does not feature a dedicated input (before it was a checkbox) to manage its own set of permissions (see section Rights and privileges), but instead offers an "universal" way to manage all available permissions.
To nevylučuje, že by nadcházející verze PageOwnership mohla opět zahrnovat vyhrazený vstup pro správu oprávnění podstránek (základní funkce PageOwnership) prostřednictvím zjednodušeného rozhraní dostupného vedle kompletního rozhraní, které však bude interně řešeno prostřednictvím nyní přijatého "univerzálnějšího" modelu práv a oprávnění.
Při přístupu ze seznamu Speciální stránky obsahuje formulář Nastavit oprávnění také dva vstupy pro omezení aktuální sady oprávnění na konkrétní stránku (stránky) a na konkrétní jmenný prostor (prostory).
Special groups/rights
From version 1.2.0 permissions to manage subpages have been improved and simplified by removing the rights "read/create/edit/move subpages (Page Ownership)" and replacing them with an unique right Includes subpages (Page Ownership), that allows to extend the set of permissions assigned to an article, to its subpages, including those yet to be created.
Additionally, a new dynamic group is now available, Article creator (Page Ownership), which is automatically assigned to an user as long as they are the article creator, i.e., the user who created the first revision of an article. This group has been inspired by the extension Extension:LockAuthor and accomplishes a similar purpose.
Both the special group "Article creator (Page Ownership)" and the special permission "Includes subpages (Page Ownership)" add an increased flexibility when combined with all other permissions and the way they can be managed. See below Extension:PageOwnership#Article_creator for a use-case.
Filtering permissions
The centralized list of permissions (when accessed from the list of Special Pages instead than from the action menu on top of content pages) can be filtered and includes fields with the related page or namespace and the user who created the permission.
"My pages" navigation section
For registered users, PageOwnership displays a section in the navigation panel with a list of pages for which a given set of permissions (between Reading, Editing, Management, Administration, and Technical) has been granted (as users, not as members of a group), if any. This way, they can quickly navigate to those pages.
To disable this feature set $wgPageOwnershipDisableSidebarPages = true; in Manual:LocalSettings.php |
Magic word/parser function
PageOwnership includes a Magic word/parser function (called either using {{pageownership userpages}} or {{#pageownership userpages:}}) (case insensitive) to display the list of pages assigned to the logged-in registered user. This can be used within articles or templates for various purposes.
Use-cases
Confidential pages
The following set of rights represent the current PageOwnership's permissions for an entire private wiki and are shown through Special:SpecialPages -> PageOwnership -> ManagePermissions (i.e. not from the action menu from a wiki article).
The first row is the most significant: it matches all users (including anonymous users, also if this is not relevant for a private wiki) and sets for them no rights (the related cell is empty) for "Confidential page a" and "Confidential page b".
The second row grants User a and User b, reading and editing-related rights (including subpages) for the page "Confidential page a".
The third row grants User c and User d, reading and editing-related rights for the page "Confidential page b".
In summary the wiki has 2 confidential pages, and those can be edited/accessed only from specific users.
Guest user
If we want to set a "guest user" (an user who is only allowed to access specific pages) we add the following permissions.
The first row matches "User e" and assigns no rights to he/she for all pages and namespaces (the related empty cells have a meaningful semantic meaning in this case)
The second row matches the same user and assigns he/she with editing-related and reading right for a "Page x".
Note in short the composite character of PageOwnership's permissions: you first match an user or group and assign to them basic permissions or no permissions, and then you grant more permissive permissions on specific pages or namespaces.
Article creator
The following settings illustrate the use of the special group "Article creator (Page Ownership)" and the special right "Includes subpages (Page Ownership)" . The first row, applied to a specific page, removes all rights for all users, and the second row assigns reading and editing permissions to the creator of such page and all its subpages.
The group "Article creator (Page Ownership)" also matches creators of newly created pages, therefore when used in conjunction with "Includes subpages (Page Ownership)" can be used to pre-assign permissions to pages yet to be created.
Namespace permissions
The following permissions have been assigned using the Special page "Special:PageOwnershipPermissions" (accessible from "Special:SpecialPages") and are not related to any specific page.
The first row removes all permissions related to all pages and namespaces of the wiki for all users, and the 2nd row assigns reading permissions to all namespaces of the wiki except Special. This way, the wiki is read-only for all users, special pages aren't accessible (except Log in) and specific namespaces or set of pages/subpages can be set as editable through additional sets of permissions.
Rights and privileges
The extension creates the following user rights. Note that because MediaWiki does not offer by default a per-page management of rights, it makes sense to use pageownership-include-subpages only through the PageOwnership's Manage permissions special page.
| right | description |
|---|---|
pageownership-canmanagepermissions |
Can manage permissions of the entire wiki |
pageownership-caneditpermissions |
Can edit permissions |
pageownership-include-subpages |
Include subpages in the current set of permissions |
Groups
| group | pageownership-canmanagepermissions | pageownership-caneditpermissions |
|---|---|---|
sysop |
v | v |
bureaucrat |
v | v |
pageownership-admin |
v | v |
As of version 1.2.0 PageOwnership also includes the group pageownership-article-author which is automatically assigned to the creator of a given article |
Global parameters
| variable | description | default |
|---|---|---|
$wgPageOwnershipDisableSidebarPages |
disables list of protected pages related to logged-in user on the sidebar | false
|
$wgPageOwnershipAdmins |
array of usernames or groups with all permissions | sysop |
$wgPageOwnershipWhitelistSpecials |
array of white-listed special pages | [ "Search", "Userlogin", "CreateAccount", "Preferences", "ChangeEmail", "Confirmemail" ]
|
$wgPageOwnershipDisableVersionCheck |
disable check of new version of the extension | false
|
API
Since version 1.2.1 PageOwnership includes the following APIs. They allow to set/get sets of permissions both through the client-side MW api, and from PHP, using the methods \PageOwnership::setPermissions and \PageOwnership::getPermissions.
| action | description | must be posted | allowed users |
|---|---|---|---|
pageownership-set-permissions |
set permissions | yes | sysop, bureaucrat, pageownership-admin |
pageownership-get-permissions |
get permissions | yes | sysop, bureaucrat, pageownership-admin |
Here are the expected parameters for each of them
| parameter | description | required |
|---|---|---|
usernames |
comma separated values of target usernames/groups for the set of permissions | true |
permissions-by-type |
any of: reading, editing, management, administration, technical | false |
additional-rights |
additional rights set by extensions as listed using RequestContext::getMain()->getConfig()->get( 'AvailableRights' ) |
false |
add-permissions |
assign specific permissions as specified in the table "Permissions by type" in the section #Setting_permissions | false |
remove-permissions |
remove specific permissions as specified in the table "Permissions by type" in the section #Setting_permissions | false |
paegids |
comma separated list of page ids, to which constrain/limit the current set of permissions | false |
namespaces |
comma separated list of namespace ids, to which constrain/limit the current set of permissions | false |
id |
id of an existing set of permissions to update (retrieved using the api pageownership-get-permissions) |
false |
The api pageownership-get-permissions can be also used to avoid to inadvertently set the same set of permissions multiple times, so a third party script or extension may first verify if the desired set of permissions for a given set of users and/or groups exists, and then to add or replace it after evaluating the api's response.
| parameter | description | required |
|---|---|---|
usernames |
comma-separated values of target usernames/groups | true |
paegids |
comma-separated list of page ids | false |
namespaces |
comma-separated list of namespace ids | false |
created-by |
actor who performed the action | false |
id |
id of an existing set of permissions | false |
Support & bugs
Please post error messages in the Talk page of the extension. Updates will be posted on this element.io chat and occasionally in the MediaWiki's Wikitech mailing list.
For professional support please write at the email address posted here
Roadmap
- implement additional right "move subpages within root page"
- write use-case to emulate Extension:GroupWhitelist
- additional form section where to toggle all rights per-group
See also
- Page specific read access extensions/cs
- Stable extensions/cs
- Hook extensions/cs
- Special page extensions/cs
- ArticleDeleteComplete extensions/cs
- BeforeInitialize extensions/cs
- BeforePageDisplay extensions/cs
- BeforeParserFetchTemplateRevisionRecord extensions/cs
- GetMagicVariableIDs extensions/cs
- LoadExtensionSchemaUpdates extensions/cs
- PageRenderingHash extensions/cs
- PageSaveComplete extensions/cs
- ParserFetchTemplate extensions/cs
- ParserFirstCallInit extensions/cs
- ParserGetVariableValueSwitch extensions/cs
- ParserOptionsRegister extensions/cs
- RejectParserCacheValue extensions/cs
- SMW::Store::AfterQueryResultLookupComplete extensions/cs
- SidebarBeforeOutput extensions/cs
- SiteNoticeBefore extensions/cs
- SkinBuildSidebar extensions/cs
- SkinTemplateNavigation::Universal extensions/cs
- TitleQuickPermissions extensions/cs
- TitleReadWhitelist extensions/cs
- GetUserPermissionsErrors extensions/cs
- GPL licensed extensions/cs
- Extensions in Wikimedia version control/cs
- All extensions/cs
- Semantic MediaWiki extensions/cs
- User rights extensions/cs
