Jump to content

Manual:Drets dels usuaris

From mediawiki.org
This page is a translated version of the page Manual:User rights and the translation is 2% complete.

Els drets d'usuari són permisos (com ara la capacitat d'editar pàgines o bloquejar usuaris) que es poden assignar a diferents grups d'usuaris. MediaWiki inclou un conjunt predeterminat de drets d'usuari i grups d'usuaris, però aquests es poden personalitzar. Aquesta pàgina explica els drets i grups predeterminats i com personalitzar-los.

Per obtenir informació sobre com afegir i eliminar usuaris wiki individuals de grups, consulteu Help:User rights and groups i Manual:Setting user groups in MediaWiki .

Changing group permissions

A default MediaWiki installation assigns certain rights to default groups (see table at #List of permissions). You can change the default rights by editing the $wgGroupPermissions array in LocalSettings.php with the following syntax:

$wgGroupPermissions['group']['right'] = true /* or false */;
In a default installation $wgGroupPermissions will be set in includes/DefaultSettings.php, but it is not present in LocalSettings.php. You will then need to add it in that file.

If a member has multiple groups, they get all the permissions from each of the groups they are in. All users, including anonymous users, are in the * group; all registered users are in the user group. In addition to the default groups, you can arbitrarily create new groups using the same array.

Examples

This example will disable viewing of all pages not listed in $wgWhitelistRead , then re-enable for registered users only:

$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:

# Disable for everyone.
$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

A custom group can be created by simply assigning rights to it via $wgGroupPermissions[ 'group-name' ] where group-name is the actual name of the group. From MW 1.12, you can create your own groups into which users are automatically promoted (as with autoconfirmed) using $wgAutopromote .

In addition to assigning permissions, you should create these three wiki pages with suitable content (see also the examples below):

  • 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 $wgAddGroups and $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;
The group name cannot contain spaces, so use '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, 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 writer, 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)

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.

Right Description User groups that have this right by default Versions
<span id="Reading">Reading
read Llegir pàgines – when set to false, override for specific pages with $wgWhitelistRead
Setting the user right 'read' to false only restricts access to wiki pages (such as articles and talk pages). Uploaded files (including images, files, docs) under the $wgUploadPath subdirectories will always remain publicly accessible via direct URL access by default.
To restrict access to uploaded files, refer to the instructions in Manual:Image authorization and img_auth.php .
*, user 1.5+
<span id="Editing">Editing
applychangetags Aplicar etiquetes juntament amb els canvis propis – requires the edit right user 1.25+
autocreateaccount Iniciar una sessió automàticament amb un compte d'usuari extern - a more limited version of createaccount 1.27+
createaccount Crear nous comptes – register / registration *, sysop 1.5+
createpage Crear pàgines (que no són de discussió) – requires the edit right *, user 1.6+
createpreviouslyrenamedaccount Create accounts with usernames previously used by renamed accounts – requires the createaccount right sysop 1.47+
createtalk Crear pàgines de discussió – requires the edit right *, user 1.6+
createwithcontentmodel Create pages with non-default content models – requires the createpage right user 1.46+
delete-redirect Eliminar les redireccions amb una única revisió (note that this is not needed if the group already has the delete right) 1.36+
edit Modificar les pàgines – requires the read right *, user 1.5+
editsemiprotected Modificar les pàgines protegides amb «semi protected» – without cascading protectionrequires the edit right autoconfirmed, bot, sysop 1.22+
editprotected Modificar pàgines protegides amb "fully protected" – without cascading protectionrequires the edit right sysop 1.13+
minoredit Marcar les edicions com a menors – requires the edit right user 1.6+
move Moure pàgines – requires the edit right user, sysop 1.5+
move-categorypages Moure pàgines de categoria – requires the move right user, sysop 1.25+
move-rootuserpages Reanomenar la pàgina principal d'un usuari – requires the move right user, sysop 1.14+
move-subpages Moure pàgines amb les seves subpàgines – requires the move right user, sysop 1.13+
movefile Moure fitxers – requires the move right as well user, sysop 1.14+
reupload Carregar al damunt d'un fitxer existent – requires the upload right user, sysop 1.6+
reupload-own Sobreescriure fitxers carregats pel propi usuari – requires the upload right (note that this is not needed if the group already has the reupload right) 1.11+
reupload-shared Sobreescriure localment fitxers presents al repositori multimèdia compartit – (if one is set up) with local files (requires the upload right) user, sysop 1.6+
sendemail Enviar missatges de correu electrònic a altres usuaris user 1.16+
upload Carregar fitxers – requires the edit right and $wgEnableUploads to be true user, sysop 1.5+
upload_by_url Carregar un fitxer des de l'adreça URL – requires the upload right (Prior to 1.20 it was given to sysops) 1.8+
<span id="Management">Management
autopatrol Modifies certain actions performed by the permission holder, automatically marking them as "patrolled" Depends on $wgUseRCPatrol , $wgUseNPPatrol , $wgUseFilePatrol bot, sysop 1.9+
bigdelete Esborrar pàgines amb historials grans (as determined by $wgDeleteRevisionsLimit ) – requires the delete right sysop 1.12+
block Blocar o desblocar altres usuaris per a impedir-los l'edició – Block options include preventing editing and registering new accounts, and autoblocking other users on the same IP address sysop 1.5+
blockemail Blocar o desblocar un usuari de l'enviament de correu electrònic – allows preventing use of the Special:Emailuser interface when blockingrequires the block right sysop 1.11+
browsearchive Cercar pàgines suprimides – through Special:Undeleterequires the deletedhistory right sysop 1.13+
changetags Afegir i suprimir etiquetes en revisions individuals i en entrades del registre – currently unused by extensions user 1.25+
delete Esborrar pàgines
1.5-1.11allows 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 Veure els historials esborrats sense consultar-ne el text sysop 1.6+
deletedtext Veure el text esborrat i els canvis entre revisions esborrades – requires the deletedhistory right sysop 1.16+
deletelogentry Suprimir i restaurar entrades específiques del registre – allows deleting/undeleting information (action text, summary, user who made the action) of specific log entries – requires the deleterevision right suppress 1.20+
deleterevision Esborrar i restaurar versions específiques de pàgines – 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 Editar el model de contingut d'una pàgina – requires the edit right user 1.23.7+
editinterface Editar la interfície d'usuari – 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 Modificar les pròpies preferències * 1.22+
editmyprivateinfo Modificar les dades privades pròpies (p. ex., adreça electrònica o nom real) i demanar reinicialitzacions de contrasenya via correu electrònic – also hides the "Change Password", but not other ways to change the passwordrequires the viewmyprivateinfo right * 1.22+
editmyusercss Modificar els vostres fitxers d'usuari CSS – 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 Modificar els vostres fitxers d'usuari JavaScript – 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+
editmyuserjsredirect Modificar els fitxers JavaScript del vostre usuari que són redireccions. (note that this is not needed if the group already has the edituserjs right)requires the edit right 1.34+
editmyuserjson Modificar els vostres propis fitxers JSON (note that this is not needed if the group already has the edituserjson right)requires the edit right user 1.31+
editmywatchlist Modificar la llista de seguiment pròpia. Tingueu en compte que algunes accions encara hi afegiran pàgines fins i tot sense tenir aquest permís. – requires the viewmywatchlist right user 1.22+
editsitecss Modificar el CSS global del lloc – requires the editinterface right interface-admin 1.32+
editsitejs Modificar el JavaScript global del lloc – requires the editinterface right interface-admin 1.32+
editsitejson Modificar el JSON global del lloc – requires the editinterface right sysop, interface-admin 1.32+
editusercss Modificar els fitxers CSS d'altres usuaris – requires the edit right interface-admin 1.16+
edituserjs Modificar els fitxers JavaScript d'altres usuaris – requires the edit right interface-admin 1.16+
edituserjson Modificar els fitxers JSON d'altres usuaris – requires the edit right sysop, interface-admin 1.31+
hideuser Blocar o desblocar un nom d'usuari, amagant-lo del públic o restaurant-lo – Only users with 1000 edits or less can be suppressed by defaultrequires the block right

Use $wgHideUserContribLimit to disable.

suppress 1.10+
ignore-restricted-groups Eviteu les condicions en l'edició de determinats grups d'usuaris restringits – Only applies to groups the user would be otherwise able to change, based on userrights right and the contents of $wgAddGroups . 1.46+
markbotedits Marcar les reversions com a edicions de bot – see Manual:Rollback requires the rollback right sysop 1.12+
mergehistory Fusionar l'historial de les pàgines – requires the edit right sysop 1.12+
pagelang Canviar l'idioma de pàgina – $wgPageLanguageUseDB must be true 1.24+
patrol Mark certain actions as "patrolled" depends on $wgUseRCPatrol , $wgUseNPPatrol , $wgUseFilePatrol sysop 1.5+
patrolmarks Veure les marques de patrulla als canvis recents (note that this is not needed if the group already has the patrol right) 1.16+
protect Canviar els paràmetres de protecció i modificar les pàgines en cascada – requires the edit right sysop 1.5+
rollback Revertir ràpidament l'últim editor d'una pàgina particularrequires the edit right sysop 1.5+
suppressionlog Veure registres privats suppress 1.6+
suppressrevision Veure, amagar i restaurar revisions específiques de pàgines per a tots els usuaris – Prior to 1.13 this right was named hiderevisionrequires the deleterevision right suppress 1.6+
unblockself Desblocar-se a si mateixos – Without it, an administrator that has the capability to block cannot unblock themselves if blocked by another administrator sysop 1.17+
undelete Restaurar pàgines suprimides – requires the deletedhistory right sysop 1.12+
userrights Editar els drets dels usuaris – 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 Editar els drets dels usuaris d'altres wikis – requires the userrights right 1.12+
viewmyprivateinfo Veure la pròpia informació privada (p. ex., adreça electrònica o nom real) * 1.22+
viewmywatchlist Veure la llista de seguiment pròpia user 1.22+
viewsuppressed Veure les revisions amagades a qualsevol usuari – 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+
<span id="Administration">Administration
deletechangetags Suprimir etiquetes des de la base de dades – currently unused by extensions sysop 1.28+
import Importar pàgines d'altres wikis – "transwiki"requires the edit right sysop 1.5+
importupload Importar pàgines carregant-les d'un fitxer – This right was called importraw in and before version 1.5requires the edit right sysop 1.5+
managechangetags Crear, activar i desactivar etiquetescurrently unused by extensions sysop 1.25+
renameuser Reanomenar usuaris (formerly was part of the Renameuser extension) bureaucrat 1.40+
siteadmin Blocar i desblocar la base de dades – which blocks all interactions with the web site except viewing. (not available by default) 1.5+
unwatchedpages Veure la llista de les pàgines no vigilades – lists pages that no user has watchlisted sysop 1.6+
<span id="Technical">Technical
apihighlimits Tenir límits més alts en les consultes a l'API bot, sysop 1.12+
autoconfirmed No veure's afectat pels límits de freqüència basats en adreça IP – used for the autoconfirmed group; see the other table below for more information (note that this is not needed if the group already has the noratelimit right) autoconfirmed, bot, sysop 1.6+
bot Ésser tractat com a procés automatitzat – edits and logged actions are hidden from recent changes, can optionally be viewed bot 1.5+
ipblock-exempt Evitar blocatges d'IP, de rang i automàtics sysop 1.9+
nominornewtalk Que les modificacions menors que facin en pàgines de discussió d'usuari no generin l'avís de nous missatges – requires the minoredit right bot 1.9+
noratelimit No veure's afectat pels límits d'accions – 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 Exportar pàgines incloent aquelles enllaçades fins a una fondària de 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.
1.15+
suppressredirect No crear redireccions quan es reanomena una pàgina – requires the move right bot, sysop 1.12+
Although these permissions all control separate things, sometimes to perform certain actions you need multiple permissions. For example allowing people to edit but not read pages doesn't make sense, since in order to edit a page you must first be able to read it (Assuming no pages are allowlisted). Allowing uploads but not editing does not make sense, since in order to upload an image you must implicitly create an image description page, etc.

Predefined 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, read, viewmyprivateinfo 1.5+
temp Temporary user accounts (T330816) Similar to * group 1.41+
user Registered accounts. Does not include temporary accounts. applychangetags, changetags, createpage, createtalk, createwithcontentmodel, edit, editcontentmodel, editmyusercss, editmyuserjs, editmyuserjson, editmywatchlist, minoredit, move, move-categorypages, move-rootuserpages, move-subpages, movefile, purge, read, reupload, reupload-shared, sendemail, upload, viewmywatchlist 1.13+
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 1.5+
sysop Users who by default can delete and restore pages, block and unblock users, etc. apihighlimits, autoconfirmed, autopatrol, bigdelete, block, blockemail, browsearchive, createaccount, createpreviouslyrenamedaccount, 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, reupload, reupload-shared, rollback, suppressredirect, unblockself, undelete, unwatchedpages, upload 1.5+
interface-admin Users who can edit sitewide CSS and JavaScript. editinterface, editsitecss, editsitejs, editsitejson, editusercss, edituserjs, edituserjson 1.32+
bureaucrat Users who can change the rights of other users by default and therefore have full access of the entire wiki. noratelimit, renameuser, userrights 1.5+
suppress deletelogentry, deleterevision, hideuser, suppressionlog, suppressrevision, viewsuppressed 1.13+

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.

Example

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.

unset( $wgGroupPermissions['bureaucrat'] );
unset( $wgRevokePermissions['bureaucrat'] );
unset( $wgAddGroups['bureaucrat'] );
unset( $wgRemoveGroups['bureaucrat'] );
unset( $wgGroupsAddToSelf['bureaucrat'] );
unset( $wgGroupsRemoveFromSelf['bureaucrat'] );

This code will not work if any extension that modifies the default rights for the bureaucrat group, such as Extension:AntiSpoof , is installed.

More broadly, to disable a user group created by an extension, the above code needs to run after all extensions have been registered. This used to be possible by registering an extension function in LocalSettings.php:

$wgExtensionFunctions[] = function() use ( &$wgGroupPermissions ) {
    unset( $wgGroupPermissions['oversight'] );
    unset( $wgGroupPermissions['flow-bot'] );
};

However, this no longer works reliably due to T275334.

Note on the group called user

With the above mechanism, you can remove the groups sysop, bureaucrat, bot, interface-admin, suppress, 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 registered user automatically is a member of that group.

This is hardcoded in MediaWiki and currently cannot be changed easily.

Default rights

The default rights are defined in MainConfigSchema.php .

  • Additional rights: you should be able to list all the permissions available on your wiki by running PermissionManager::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 PermissionManager.php , CORE_RIGHTS (example). If you're doing so in an extension , you instead need to use $wgAvailableRights , or preferably define the right in extensions.json .

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