Jump to content

Manual:Användarrättigheter

From mediawiki.org
This page is a translated version of the page Manual:User rights and the translation is 44% complete.
Outdated translations are marked like this.

Användarrättigheter är tillstånd (som förmågan att redigera sidor eller blockera användare) som kan tilldelas olika användargrupper. MediaWiki delar ut en standarduppsättning användarrättigheter och användargrupper, men dessa kan anpassas. Den här sidan förklarar standardrättigheterna och grupperna och hur man anpassar dem.

För information om hur man lägger till och tar bort enskilda wikianvändare från grupper, läs Help:Användarrättigheter och grupper och Manual:Definiera användargrupper i MediaWiki .

Ändra grupprättigheter

A default MediaWiki installation assigns certain rights to default groups (see below). You can change the default rights by editing the $wgGroupPermissions array in LocalSettings.php with the 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.

Exempel

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;

Skapa en ny grupp och tilldela den rättigheter

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.

Exempel

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, 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 "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)

Ta bort fördefinierade grupper

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.

Exempel

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:AntiSpoof 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'] );
};


Fotnot på gruppen som heter "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 registered user automatically is a member of that group. This is hardcoded in MediaWiki and currently cannot be changed easily.

Lista över rättigheter

Följande användarrättigheter finns tillgängliga i den senaste versionen av MediaWiki. Om du använder en äldre version, se Special:Version på din wiki och se om din version finns med i kolumnen "Version".

Rättighet Beskrivning Användargrupper som har den här rättigheten som standard Versioner
Utläsning
read Se sidor - om den definieras som "false" överskrids vissa sidor med $wgWhitelistRead
Varning Varning: Setting the user right read (allow viewing pages) to false will only protect wiki (article, talk, ...) pages, but uploaded files (images, files, docs... in the $wgUploadPath subdirectories) will always remain readable via direct access by default.
Use the information from Manual:Image authorization and img_auth.php pages when you have the need to restrict image views and file download access to only logged-in users.
*, user 1.5+
Redigering
applychangetags Tillämpa märken tillsammans med ens ändringar - requires the edit right user 1.25+
autocreateaccount Logga in automatiskt med ett externt användarkonto - en mer begränsad version av createaccount 1.27+
createaccount Skapa nya användarkonton - register / registration *, sysop 1.5+
createpage Skapa sidor (som inte är diskussionssidor) - kräver rättigheten edit *, user 1.6+
createtalk Skapa diskussionssidor - kräver rättigheten edit *, user 1.6+
delete-redirect Radera omdirigeringar med en version (note that this is not needed if the group already has the delete right) 1.36+
edit Redigera sidor *, user 1.5+
editsemiprotected Redigera skyddade sidor som ”Allow only autoconfirmed users” - without cascading protection - requires the edit right autoconfirmed, bot, sysop 1.22+
editprotected Redigera skyddade sidor som ”Allow only administrators” - without cascading protection - requires the edit right sysop 1.13+
minoredit Markera redigeringar som mindre - requires the edit right user 1.6+
move Flytta sidor - kräver rättigheten edit user, sysop 1.5+
move-categorypages Flytta kategorisidor - kräver rättigheten move user, sysop 1.25+
move-rootuserpages Flytta root-användarsidor - kräver rättigheten move user, sysop 1.14+
move-subpages Flytta sidor med deras undersidor - kräver rättigheten move user, sysop 1.13+
movefile Flytta filer - kräver rättigheten move och att $wgAllowImageMoving stämmer user, sysop 1.14+
reupload Skriv över existerande filer - kräver rättigheten upload user, sysop 1.6+
reupload-own Skriv över egna filer - kräver rättigheten upload (notera att det inte behövs om gruppen redan har rättigheten reupload) 1.11+
reupload-shared Skriv över delade filer lokalt - (om en satts upp) med lokala filer (kräver rättigheten upload) user, sysop 1.6+
sendemail Skicka e-post till andra användare user 1.16+
upload Ladda upp filer - kräver rättigheten edit och att $wgEnableUploads stämmer user, sysop 1.5+
upload_by_url Ladda upp en fil genom en webbadress - kräver rättigheten upload (Innan 1.20 gavs den till systemoperatörer) 1.8+
Ledning
bigdelete Radera sidor med stor historik (som bestämd av $wgDeleteRevisionsLimit ) - kräver rättigheten delete sysop 1.12+
block Blockera eller avblockera andra användare från att redigera - Block options include preventing editing and registering new accounts, and autoblocking other users on the same IP address sysop 1.5+
blockemail Blockera eller avblockera en användare från att skicka e-post - allows preventing use of the Special:Emailuser interface when blocking - requires the block right sysop 1.11+
browsearchive Sök efter raderade sidor - via Special:Undelete - kräver rättigheten deletedhistory sysop 1.13+
changetags Lägg till och ta bort godtyckliga märken på individuella sidversioner och loggposter. - används för närvarande inte av tillägg user 1.25+
delete Radera sidor 1.5–1.11: tillåter radering eller återställning av sidor
1.12+: tillåter radering av sidor För återställningar finns det rättigheten 'undelete', se nedan
sysop 1.5+
deletedhistory Se raderad historik utan tillhörande sidtext sysop 1.6+
deletedtext Visa raderad text och ändringar mellan raderade versioner sysop
deletelogentry Radera och återställ specifika loggposter - tillåter radering/återställning av information (åtgärdstext, sammanfattning, användare som utförde åtgärden) om specifika logginlägg - kräver rättigheten deleterevision suppress 1.20+
deleterevision Radera och återställa enskilda sidversioner - tillåter radering/återställning av information (åtgärdstext, sammanfattning, användare som utförde åtgärden) om specifika sidversioner Dela i deleterevision och deletelogentry i 1.20 suppress 1.6+
editcontentmodel Ändra innehållsmodellen för en sida - kräver rättigheten edit user 1.23.7+
editinterface Redigera användargränssnittet - innehåller gränssnittsmeddelanden. For editing sitewide CSS/JSON/JS, there are now segregate rights, see below. - kräver rättigheten edit sysop, interface-admin 1.5+
editmyoptions Redigera dina egna inställningar * 1.22+
editmyprivateinfo Redigera dina egen privata data (t.ex. e-postadress, riktiga namn) och begära e-post om att återställa lösenord - also hides the "Change Password", but not other ways to change the password - requires the viewmyprivateinfo right * 1.22+
editmyusercss Redigera din egen användares CSS-filer - 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) - kräver rättigheten edit user 1.22+
editmyuserjs Redigera din egen användares JavaScript-filer - 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) - kräver rättigheten edit user 1.22+
editmyuserjsredirect Redigera dina egna JavaScript-filer som är omdirigeringar (note that this is not needed if the group already has the edituserjs right) - requires the edit right 1.34+
editmyuserjson Redigera dina egna JSON-filer (note that this is not needed if the group already has the edituserjson right) - kräver rättigheten edit user 1.31+
editmywatchlist Redigera din egen bevakningslista (observera att en del åtgärder kommer fortfarande lägga till sidor även utan denna rättighet) - requires the viewmywatchlist right * 1.22+
editsitecss Redigera CSS för hela webbplatsen - kräver rättigheten editinterface interface-admin 1.32+
editsitejs Redigera JavaScript för hela webbplatsen - kräver rättigheten editinterface interface-admin 1.32+
editsitejson Redigera JSON för hela webbplatsen - kräver rättigheten editinterface sysop, interface-admin 1.32+
editusercss Redigera andra användares CSS-filer - kräver rättigheten edit interface-admin 1.16+
edituserjs Redigera andra användares JavaScript-filer - kräver rättigheten edit interface-admin 1.16+
edituserjson Redigera andra användares JSON-filer - kräver rättigheten edit sysop, interface-admin 1.31+
hideuser Blockera eller avblockera ett användarnamn, dölj eller återställ det för allmänheten - Only users with 1000 edits or less can be suppressed by default - requires the block right

Använd $wgHideUserContribLimit för att stänga av.

suppress 1.10+
markbotedits Markera tillbakarullningar som robotändringar - se Manual:Rollback - kräver rättigheten rollback sysop 1.12+
mergehistory Sammanfoga sidhistoriker - kräver rättigheten edit sysop 1.12+
pagelang Ändra sidspråk - $wgPageLanguageUseDB måste vara true 1.24+
patrol Markera ändringar som patrullerade - $wgUseRCPatrol måste vara true sysop 1.5+
patrolmarks Se markeringar av opatrullerade ändringar i senaste ändringarna 1.16+
protect Ändra skrivskyddsinställningar och redigera kaskadskyddade sidor - kräver rättigheten edit sysop 1.5+
rollback Rulla tillbaka den användare som senast redigerat en sida - kräver rättigheten edit sysop 1.5+
suppressionlog Se privata loggar suppress 1.6+
suppressrevision Se, dölj och ta fram specifika sidversioner som dolts för alla användare - Innan 1.13 hette den här rättigheten hiderevision - kräver rättigheten deleterevision suppress 1.6+
unblockself Avblockera sig själv - Without it, an administrator that has the capability to block cannot unblock themselves if blocked by another administrator sysop 1.17+
undelete Återställ raderade sidor - kräver rättigheten deletedhistory sysop 1.12+
userrights Redigera alla användarrättigheter - 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 Redigera användarrättigheterna på andra wikier - requires the userrights right 1.12+
viewmyprivateinfo Visa dina egna privata data (t.ex. e-postadress, riktiga namn) * 1.22+
viewmywatchlist Visa din egen bevakningslista * 1.22+
viewsuppressed Se sidversioner som dolts från alla användare - 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+
Administrering
autopatrol Får automatiskt sina ändringar markerade som patrullerade - $wgUseRCPatrol must be true bot, sysop 1.9+
deletechangetags Radera märken från databasen - används för närvarande inte av tillägg sysop 1.28+
import Importera sidor från andra wikier - "transwiki" - kräver rättigheten edit sysop 1.5+
importupload Importera sidor genom uppladdning - Rättigheten hette 'importraw' i och innan version 1.5 - kräver rättigheten edit sysop 1.5+
managechangetags Skapa och (in)aktivera märken - används för närvarande inte av tillägg sysop 1.25+
siteadmin Lås och öppna databasen - which blocks all interactions with the web site except viewing. (not available by default) 1.5+
unwatchedpages Se en lista över obevakade sidor - lists pages that no user has watchlisted sysop 1.6+
Teknisk
apihighlimits Använda högre gränser i API-frågor bot, sysop 1.12+
autoconfirmed Påverkas inte av IP-baserade hastighetsgränser - 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 Behandlas som en automatisk process - can optionally be viewed bot 1.5+
ipblock-exempt Kan redigera från blockerade IP-adresser sysop 1.9+
nominornewtalk Mindre ändringar på diskussionssidor ger inte besked om nya meddelanden - kräver rättigheten minoredit bot 1.9+
noratelimit Påverkas inte av hastighetsgränser - 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 Exportera sidor inklusive länkade sidor till ett djup på 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.
?
suppressredirect Skapa inte omdirigeringar från ursprungssidan vid sidflyttning - kräver rättigheten move 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.


Lista över grupper

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+
temp Temporary user accounts (T330816) Similar to * group 1.41+
user Registered accounts. Does not include temporary 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, 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 can change the rights of other users by default and therefore have full access of the entire wiki. noratelimit, userrights 1.5+
suppress deletelogentry, deleterevision, hideuser, suppressionlog, suppressrevision, viewsuppressed

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 MainConfigSchema.php .

  • Default values in HEAD version:

https://phabricator.wikimedia.org/diffusion/MW/browse/master/includes/MainConfigSchema.php

  • The default values in the latest stable MediaWiki release, version 1.42, are available here:

https://phabricator.wikimedia.org/diffusion/MW/browse/REL1_42/includes/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 , $coreRights (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 ...".


Se även