คู่มือ:สิทธิ์ของผู้ใช้
สิทธิ์ผู้ใช้ คือสิทธิ์การเข้าถึงและความสามารถเฉพาะที่สามารถกำหนดให้กับ กลุ่มผู้ใช้ ที่ปรับแต่งได้ MediaWiki ships with a default set of user rights and user groups, but these can be customized. This page explains the default rights and groups and how to customize them.
For information about how to add and remove individual wiki users from groups, see Help:User rights and groups and Manual:Setting user groups in MediaWiki .
การเปลี่ยนการอนุญาตของกลุ่ม
การติดตั้ง MediaWiki เริ่มต้นกำหนดสิทธิ์บางอย่างให้กับกลุ่มเริ่มต้น (ดูด้านล่าง) คุณสามารถเปลี่ยนสิทธิ์เริ่มต้นได้ด้วยการแก้ไขอาร์เรย์ $GroupPermissions ใน $LocalSettings ด้วยไวยากรณ์
$wgGroupPermissions['group']['right'] = true /* หรือ false */;
includes/DefaultSettings.php
แต่จะมี ไม่ อยู่ใน LocalSettings.php
จากนั้นคุณจะต้องเพิ่มลงในไฟล์นั้นหากสมาชิกมีหลายกลุ่มพวกเขาจะได้รับสิทธิ์ทั้งหมดจากแต่ละกลุ่มที่พวกเขาอยู่
ผู้ใช้ทั้งหมดรวมถึงผู้ใช้ที่ไม่ระบุชื่ออยู่ในกลุ่ม '*'
ผู้ใช้ที่ลงทะเบียนทั้งหมดอยู่ในกลุ่ม 'user'
นอกเหนือจากกลุ่มเริ่มต้นคุณสามารถสร้างกลุ่มใหม่โดยใช้อาเรย์เดียวกัน
ตัวอย่าง
ตัวอย่างนี้จะปิดใช้งานการดูหน้าทั้งหมดที่ไม่อยู่ในรายการ $wgWhitelistRead จากนั้นเปิดใช้งานใหม่สำหรับผู้ใช้ที่ลงทะเบียนเท่านั้น:
$wgGroupPermissions['*']['read'] = false;
# The following line is not actually necessary, since it's in the defaults. Setting '*' to false doesn't disable rights for groups that have the right separately set to true!
$wgGroupPermissions['user']['read'] = true;
This example will disable editing of all pages, then re-enable for users with confirmed email addresses only:
# ปิดการใช้งานสำหรับทุกคน
$wgGroupPermissions['*']['edit'] = false;
# Disable for users, too: by default 'user' is allowed to edit, even if '*' is not.
$wgGroupPermissions['user']['edit'] = false;
# Make it so users with confirmed email addresses are in the group.
$wgAutopromote['emailconfirmed'] = APCOND_EMAILCONFIRMED;
# Hide group from user list.
$wgImplicitGroups[] = 'emailconfirmed';
# Finally, set it to true for the desired group.
$wgGroupPermissions['emailconfirmed']['edit'] = true;
Creating a new group and assigning permissions to it
You can create new user groups by defining permissions for the according group name in $wgGroupPermissions['<group-name>']
where <group-name> is the actual name of the group.
Additionally to assigning permissions, you should create these three wiki pages with fitting content:
- MediaWiki:Group-<group-name> (content:
Name of the group
) - MediaWiki:Group-<group-name>-member (content:
Name of a member of the group
) - MediaWiki:Grouppage-<group-name> (content:
Name of the group page
)
By default, bureaucrats can add users to, or remove them from, any group. However, if you are using Manual:$wgAddGroups and Manual:$wgRemoveGroups , you may need to customize those instead.
Examples
This example will create an arbitrary "projectmember" group that can block users and delete pages, and whose edits are hidden by default in the recent changes log:
$wgGroupPermissions['projectmember']['bot'] = true;
$wgGroupPermissions['projectmember']['block'] = true;
$wgGroupPermissions['projectmember']['delete'] = true;
'random-group'
or 'random_group'
instead of 'random group'
. Moreover it is recommended to only use lowercase letters to create a group.In this example, you would probably also want to create these pages:
- MediaWiki:Group-projectmember (content:
Project members
) - MediaWiki:Group-projectmember-member (content:
Project member
) - MediaWiki:Grouppage-projectmember (content:
Project:Project Members
)
This will ensure that the group will be referred to as "Project members" throughout the interface, and a member will be referred to as a "Project member", and overviews will link the group name to Project:Project members.
This example disables write access (page editing and creation) by default, creates a group named "Write", and grants it write access. Users can be manually added to this group via Special:UserRights:
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['createpage'] = false;
$wgGroupPermissions['user']['edit'] = false;
$wgGroupPermissions['user']['createpage'] = false;
$wgGroupPermissions['writer']['edit'] = true;
$wgGroupPermissions['writer']['createpage'] = true;
In this example, you would probably also want to create these pages:
- MediaWiki:Group-writer (content:
Writers
) - MediaWiki:Group-writer-member (content:
Writer
) - MediaWiki:Grouppage-writer (content:
Project:Write
)
Removing predefined groups
MediaWiki out of the box comes with a number of predefined groups.
Most of these groups can be removed by unsetting the according array keys, among them $wgGroupPermissions['<group-name>']
.
For details see below.
ตัวอย่าง
This example will eliminate the bureaucrat group entirely.
It is necessary to ensure that all six of these variables are unset for any group that one wishes to remove from being listed at Special:ListGroupRights; however, merely unsetting $wgGroupPermissions will suffice to remove it from Special:UserRights.
This code should be placed after any require_once
lines that add extensions such as Extension:Renameuser containing code that gives bureaucrats group permissions by default.
unset( $wgGroupPermissions['bureaucrat'] );
unset( $wgRevokePermissions['bureaucrat'] );
unset( $wgAddGroups['bureaucrat'] );
unset( $wgRemoveGroups['bureaucrat'] );
unset( $wgGroupsAddToSelf['bureaucrat'] );
unset( $wgGroupsRemoveFromSelf['bureaucrat'] );
In some extensions (Flow, Semantic MediaWiki, etc.), rights are added during extension registration or in a registration function. In this case, it could be necessary to use a registration function in LocalSettings.php to remove some predefined user groups:
$wgExtensionFunctions[] = function() use ( &$wgGroupPermissions ) {
unset( $wgGroupPermissions['oversight'] );
unset( $wgGroupPermissions['flow-bot'] );
};
Note on the group called "user"
With the above mechanism, you can remove the groups sysop, bureaucrat and bot, which - if used - can be assigned through the usual user permission system.
However, it is currently impossible to remove the user
group.
This group is not assigned through the usual permission system.
Instead, every logged in user automatically is member of that group.
This is hardcoded in MediaWiki and currently cannot be changed easily.
List of permissions
The following user rights are available in the latest version of MediaWiki. If you are using an older version, look at "Special:Version" on your wiki and see if your version is covered in the "Versions" column.
สิทธิ | รายละเอียด | User groups that have this right by default | เวอร์ชั่น |
---|---|---|---|
การอ่าน | |||
read | อ่านหน้า - when set to false, override for specific pages with $wgWhitelistRead
|
*, user | 1.5+ |
การแก้ไข | |||
applychangetags | ใช้ป้ายระบุร่วมกับการเปลี่ยนแปลงของผู้ใช้ | user | 1.25+ |
autocreateaccount | เข้าสู่ระบบด้วยบัญชีผู้ใช้ภายนอกอัตโนมัติ - a more limited version of createaccount | — | 1.27+ |
createaccount | สร้างบัญชีผู้ใช้ใหม่ - register / registration | *, sysop | 1.5+ |
createpage | สร้างหน้า (ที่ไม่ใช่หน้าอภิปราย) - ขอสิทธิ edit | *, user | 1.6+ |
createtalk | สร้างหน้าอภิปราย - ขอสิทธิ edit | *, user | 1.6+ |
edit | แก้ไขหน้า | *, user | 1.5+ |
editsemiprotected | แก้ไขหน้าที่ถูกล็อกในฐานะ "Allow only autoconfirmed users" - without cascading protection | autoconfirmed, bot, sysop | 1.22+ |
editprotected | แก้ไขหน้าที่ถูกล็อกในฐานะ "Allow only administrators" - without cascading protection | sysop | 1.13+ |
minoredit | ทำเครื่องหมายการแก้ไขเป็นการแก้ไขเล็กน้อย | user | 1.6+ |
move | ย้ายหน้า - requires the edit right | user, sysop | 1.5+ |
move-categorypages | ย้ายหน้าหมวดหมู่ - requires the move right | user, sysop | 1.25+ |
move-rootuserpages | ย้ายหน้าผู้ใช้หลัก - requires the move right | user, sysop | 1.14+ |
move-subpages | ย้ายหน้าพร้อมหน้าย่อย - requires the move right | user, sysop | 1.13+ |
movefile | ย้ายไฟล์ - requires the move right and $wgAllowImageMoving to be true | user, sysop | 1.14+ |
reupload | บันทึกทับไฟล์เดิม - requires the upload right | user, sysop | 1.6+ |
reupload-own | บันทึกทับไฟล์เดิมที่คุณอัปโหลดเอง - requires the upload right (note that this is not needed if the group already has the reupload right) | — | 1.11+ |
reupload-shared | บันทึกทับไฟล์บนคลังร่วมสื่อท้องถิ่น - (if one is set up) with local files (requires the upload right) | user, sysop | 1.6+ |
sendemail | ส่งอีเมลหาผู้ใช้อื่น | user | 1.16+ |
upload | อัปโหลดไฟล์ - requires the edit right and $wgEnableUploads to be true | user, sysop | 1.5+ |
upload_by_url | อัปโหลดไฟล์จากยูอาร์แอล - requires the upload right (Prior to 1.20 it was given to sysops) | — | 1.8+ |
Management | |||
bigdelete | ลบหน้าที่มีประวัติใหญ่ (as determined by $wgDeleteRevisionsLimit) - requires the delete right | sysop | 1.12+ |
block | บล็อกมิให้ผู้ใช้อื่นแก้ไข - Block options include preventing editing and registering new accounts, and autoblocking other users on the same IP address | sysop | 1.5+ |
blockemail | บล็อกผู้ใช้มิให้ส่งอีเมล - allows preventing use of the Special:Emailuser interface when blocking - requires the block right | sysop | 1.11+ |
browsearchive | ค้นหาหน้าที่ถูกลบ - through Special:Undelete - requires the deletedhistory right | sysop | 1.13+ |
changetags | เพิ่มและลบป้ายระบุคงค่าต่อรุ่นแก้ไขและหน่วยปูมหนึ่ง - currently unused by extensions | user | 1.25+ |
delete | ลบหน้า 1.5–1.11: allows the deletion or undeletion of pages. 1.12+: allows the deletion of pages. For undeletions, there is now the 'undelete' right, see below |
sysop | 1.5+ |
deletedhistory | ดูหน่วยประวัติที่ถูกลบ โดยไม่มีข้อความของหน่วยนั้น | sysop | 1.6+ |
deletedtext | ดูข้อความที่ถูกลบและการเปลี่ยนแปลงระหว่างรุ่นที่ถูกลบ | sysop | |
deletelogentry | ลบและกู้คืนหน่วยปูมจำเพาะ - allows deleting/undeleting information (action text, summary, user who made the action) of specific log entries - requires the deleterevision right | suppress | 1.20+ |
deleterevision | ลบและกู้คืนรุ่นจำเพาะของหน้า - allows deleting/undeleting information (revision text, edit summary, user who made the edit) of specific revisions Split into deleterevision and deletelogentry in 1.20 | suppress | 1.6+ |
editcontentmodel | แก้ไขตัวแบบเนื้อหาของหน้า - requires the edit right | user | 1.23.7+ |
editinterface | แก้ไขอินเตอร์เฟซผู้ใช้ - contains interface messages. For editing sitewide CSS/JSON/JS, there are now segregate rights, see below. - requires the edit right | sysop, interface-admin | 1.5+ |
editmyoptions | แก้ไขการตั้งค่าของคุณ | * | 1.22+ |
editmyprivateinfo | แก้ไขข้อมูลส่วนตัวของคุณ (เช่น ที่อยู่อีเมล ชื่อจริง) | * | 1.22+ |
editmyusercss | แก้ไขไฟล์ซีเอสเอสผู้ใช้ของคุณเอง - prior to 1.31 it was assigned to everyone (i.e. "*") (note that this is not needed if the group already has the editusercss right) - requires the edit right | user | 1.22+ |
editmyuserjs | แก้ไขไฟล์จาวาสคริปต์ผู้ใช้ของคุณเอง - prior to 1.31 it was assigned to everyone (i.e. "*") (note that this is not needed if the group already has the edituserjs right) - requires the edit right | user | 1.22+ |
editmyuserjson | แก้ไขไฟล์ JSON ผู้ใช้ของคุณเอง (note that this is not needed if the group already has the edituserjson right) - requires the edit right | user | 1.31+ |
editmywatchlist | แก้ไขรายการเฝ้าดูของคุณ หมายเหตุว่า บางปฏิบัติการจะยังเพิ่มหน้าแม้ปราศจากสิทธินี้ | * | 1.22+ |
editsitecss | แก้ไข CSS ทั้งเว็บ - requires the editinterface right | interface-admin | 1.32+ |
editsitejs | แก้ไขจาวาสคริปต์ทั้งเว็บ - requires the editinterface right | interface-admin | 1.32+ |
editsitejson | แก้ไข JSON ทั้งเว็บ - requires the editinterface right | sysop, interface-admin | 1.32+ |
editusercss | แก้ไขไฟล์ CSS ของผู้ใช้อื่น - requires the edit right | interface-admin | 1.16+ |
edituserjs | แก้ไขไฟล์จาวาสคริปต์ของผู้ใช้อื่น - requires the edit right | interface-admin | 1.16+ |
edituserjson | แก้ไขไฟล์ JSON ของผู้ใช้อื่น - requires the edit right | sysop, interface-admin | 1.31+ |
hideuser | บล็อกชื่อผู้ใช้ ซ่อนไม่ให้สาธารณะเห็น - Only users with 1000 edits or less can be suppressed by default.
Use |
suppress | 1.10+ |
markbotedits | ทำเครื่องหมายการย้อนกลับฉุกเฉินว่าเป็นการแก้ไขโดยบอต - see Manual:Administrators#Rollback - requires the rollback right | sysop | 1.12+ |
mergehistory | ผสานประวัติหน้า - requires the edit right | sysop | 1.12+ |
pagelang | เปลี่ยนภาษาหน้า - $wgPageLanguageUseDB must be true | — | 1.24+ |
patrol | ทำเครื่องหมายการแก้ไขของผู้อื่นว่าตรวจสอบแล้ว - $wgUseRCPatrol must be true | sysop | 1.5+ |
patrolmarks | ดูการทำเครื่องหมายตรวจสอบในการเปลี่ยนแปลงล่าสุด | — | 1.16+ |
protect | เปลี่ยนระดับการล็อกและแก้ไขหน้าที่ถูกล็อกแบบต่อเรียง - requires the edit right | sysop | 1.5+ |
rollback | ย้อนการแก้ไขของผู้ใช้ล่าสุดที่แก้ไขหน้าเฉพาะอย่างรวดเร็ว - requires the edit right | sysop | 1.5+ |
suppressionlog | ดูปูมส่วนตัว | suppress | 1.6+ |
suppressrevision | ดู ซ่อนและเปิดเผยรุ่นจำเพาะของหน้าจากผู้ใช้ทุกคน - Prior to 1.13 this right was named hiderevision - requires the deleterevision right | suppress | 1.6+ |
unblockself | ปลดบล็อกตนเอง - Without it, an administrator that has the capability to block cannot unblock themselves if blocked by another administrator | sysop | 1.17+ |
undelete | กู้คืนหน้า - requires the deletedhistory right | sysop | 1.12+ |
userrights | แก้ไขสิทธิผู้ใช้ทั้งหมด - allows the assignment or removal of all(*) groups to any user. (*)With $wgAddGroups and $wgRemoveGroups you can set the possibility to add/remove certain groups instead of all |
bureaucrat | 1.5+ |
userrights-interwiki | แก้ไขสิทธิผู้ใช้ของผู้ใช้บนวิกิอื่น | — | 1.12+ |
viewmyprivateinfo | ดูข้อมูลส่วนตัวของคุณ (เช่น ที่อยู่อีเมล ชื่อจริง) | * | 1.22+ |
viewmywatchlist | ดูรายการเฝ้าดูของคุณ | * | 1.22+ |
viewsuppressed | ดูรุ่นที่ถูกซ่อนจากผู้ใช้ทุกคน - i.e. a more narrow alternative to "suppressrevision" (note that this is not needed if the group already has the suppressrevision right) | suppress | 1.24+ |
Administration | |||
autopatrol | ให้ทำเครื่องหมายการแก้ไขของตนเองเป็นตรวจสอบแล้วอัตโนมัติ - $wgUseRCPatrol must be true | bot, sysop | 1.9+ |
deletechangetags | ลบป้ายระบุออกจากฐานข้อมูล - currently unused by extensions | sysop | 1.28+ |
import | นำเข้าหน้าจากวิกิอื่น - "transwiki" - requires the edit right | sysop | 1.5+ |
importupload | นำเข้าหน้าจากไฟล์ที่อัปโหลด - This right was called 'importraw' in and before version 1.5 - requires the edit right | sysop | 1.5+ |
managechangetags | สร้างและเปิด/ปิดใช้งานป้ายระบุ - currently unused by extensions | sysop | 1.25+ |
siteadmin | ล็อกและปลดล็อกฐานข้อมูล - which blocks all interactions with the web site except viewing. (not available by default) | — | 1.5+ |
unwatchedpages | ดูรายการหน้าที่ไม่มีผู้เฝ้าดู - lists pages that no user has watchlisted | sysop | 1.6+ |
Technical | |||
apihighlimits | ใช้ข้อจำกัดที่สูงขึ้นในคำสั่งเอพีไอ | bot, sysop | 1.12+ |
autoconfirmed | ไม่ได้รับผลจากขีดจำกัดอัตรายึดเลขที่อยู่ไอพี - used for the 'autoconfirmed' group, see the other table below for more information | autoconfirmed, bot, sysop | 1.6+ |
bot | กำหนดเป็นกระบวนการอัตโนมัติ - can optionally be viewed | bot | 1.5+ |
ipblock-exempt | เลี่ยงการบล็อกเลขที่อยู่ไอพี บล็อกอัตโนมัติ และบล็อกช่วง | sysop | 1.9+ |
nominornewtalk | หากไม่มีการแก้ไขเล็กน้อยในหน้าอภิปรายจะทำให้การแจ้งข้อความใหม่ปรากฏ - requires the minoredit right | bot | 1.9+ |
noratelimit | ไม่ได้รับผลกระทบจากขีดจำกัดอัตรา - not affected by rate limits (prior to the introduction of this right, the configuration variable $wgRateLimitsExcludedGroups was used for this purpose) | sysop, bureaucrat | 1.13+ |
override-export-depth | ส่งออกหน้า รวมหน้าที่เชื่อมโยงกับหน้านี้สูงสุด 5 ลำดับชั้น With this right, you can define the depth of linked pages at Special:Export. Otherwise, the value of $wgExportMaxLinkDepth , which is 0 by default, will be used. |
— | ? |
purge | ล้างแคชของเว็บไซต์สำหรับหน้าหนึ่ง - URL parameter "&action=purge "
|
user | 1.10+ |
suppressredirect | ไม่สร้างหน้าเปลี่ยนทางจากหน้าต้นทางเมื่อย้ายหน้า - requires the move right | bot, sysop | 1.12+ |
writeapi | ใช้การเขียนเอพีไอ - requires the edit right | *, user, bot | 1.13+ |
List of groups
The following groups are available in the latest version of MediaWiki. If you are using an older version then some of these may not be implemented.
Group | Description | Default rights | Versions |
---|---|---|---|
* | all users (including anonymous). | createaccount, createpage, createtalk, edit, editmyoptions, editmyprivateinfo, editmywatchlist, read, viewmyprivateinfo, viewmywatchlist, writeapi | 1.5+ |
user | registered accounts. | applychangetags, changetags, createpage, createtalk, edit, editcontentmodel, editmyusercss, editmyuserjs, editmyuserjson, minoredit, move, move-categorypages, move-rootuserpages, move-subpages, movefile, purge, read, reupload, reupload-shared, sendemail, upload, writeapi | |
autoconfirmed | registered accounts at least as old as $wgAutoConfirmAge and having at least as many edits as $wgAutoConfirmCount . | autoconfirmed, editsemiprotected | 1.6+ |
bot | accounts with the bot right (intended for automated scripts). | autoconfirmed, autopatrol, apihighlimits, bot, editsemiprotected, nominornewtalk, suppressredirect, writeapi | 1.5+ |
sysop | users who by default can delete and restore pages, block and unblock users, et cetera. | apihighlimits, autoconfirmed, autopatrol, bigdelete, block, blockemail, browsearchive, createaccount, delete, deletedhistory, deletedtext, editinterface, editprotected, editsemiprotected, editsitejson, edituserjson, import, importupload, ipblock-exempt, managechangetags, markbotedits, mergehistory, move, move-categorypages, move-rootuserpages, move-subpages, movefile, noratelimit, patrol, protect, proxyunbannable, reupload, reupload-shared, rollback, suppressredirect, unblockself, undelete, unwatchedpages, upload | 1.5+ |
interface-admin | users who can edit sitewide CSS/JS. | editinterface, editsitecss, editsitejs, editsitejson, editusercss, edituserjs, edituserjson | 1.32+ |
bureaucrat | users who by default can change other users' rights. | noratelimit, userrights | 1.5+ |
From MW 1.12, you can create your own groups into which users are automatically promoted (as with autoconfirmed and emailconfirmed) using $wgAutopromote . You can even create any custom group by just assigning rights to them.
Default rights
The default rights are defined in DefaultSettings.php .
- Default values in HEAD version:
https://phabricator.wikimedia.org/diffusion/MW/browse/master/includes/DefaultSettings.php
- The default values in the latest stable MediaWiki release, version 1.35, are available here:
https://phabricator.wikimedia.org/diffusion/MW/browse/REL1_35/includes/DefaultSettings.php
- Additional rights: you should be able to list all the permissions available on your wiki by running
User::getAllRights()
.
Adding new rights
Information for coders only follows.
If you're adding a new right in core, for instance to control a new special page, you are required to add it to the list of available rights in User.php , $mCoreRights
(example).
If you're doing so in an extension , you instead need to use $wgAvailableRights .
You probably also want to assign it to some user group by editing $wgGroupPermissions described above.
If you want this right to be accessible to external applications by OAuth or by bot passwords, then you will need to add it to a grant by editing $wgGrantPermissions .
// create projectmember-powers right
$wgAvailableRights[] = 'projectmember-powers';
// add projectmember-powers to the projectmember-group
$wgGroupPermissions['projectmember']['projectmember-powers'] = true;
// add projectmember-powers to the 'basic' grant so we can use our projectmember powers over an API request
$wgGrantPermissions['basic']['projectmember-powers'] = true;
You also need to add right-[name]
and action-[name]
interface messages to /languages/i18n/en.json (with documentation in qqq.json).
The right-* messages can be seen on Special:ListGroupRights and the action-* messages are used in a sentence like "You do not have permission to ...".
See also
- Special:ListGroupRights – links to this help page and might contain not yet documented rights
- Help:User rights and groups – help page describing use of the Special:Userrights interface (for bureaucrats)
- Manual:Setting user groups in MediaWiki – information about managing and the assignment of user groups.
- Manual:$wgNamespaceProtection
- Manual:$wgAutopromote
- Manual:$wgAddGroups , Manual:$wgRemoveGroups
- Manual:Preventing access – ตัวอย่าง
- Manual:Establishing a hierarchy of bureaucrats
- Category:User rights extensions – Many extensions relating to user rights