Manual:Preventing access/fr

Pour l'aide concernant la personnalisation des droits utilisateurs, voir. Cette page contient des exemples utiles pour restreindre l'accès.

La plupart des exemples ont besoin d'avoir modifié le fichier de configuration  de MediaWiki. Les extraits de code sans instructions qui les accompagnent doivent être ajoutés à  pour être effectifs. Pour ajouter une ou plusieurs lignes dans le fichier, suivez ces étapes :


 * 1) S'il y a un   à la fin du ficher, enlevez-le. Cela n'est pas nécessaire et peut nuire dans certaines situations.
 * 2) Ajoutez la ligne à la fin du fichier, en utilisant un éditeur de texte. Le fait qu'il y ait des lignes blanches avant ou après l'addition n'a pas d'importance. N'utilisez pas Notepad de Windows, qui peut ajouter un "indicateur d'ordre des octets" (BOM - Byte Order Mark) et empêcher le fichier d'être lu correctement. Les symptomes typiques de la présence de BOMs sont les pages blanches et les erreurs concernant les entêtes déja envoyées. Pour supprimer le BOM du fichier, vous devez utiliser un éditeur hexadécimal. Windows WordPad semble convenir, tout comme Notepad++. La suppression des BOMs peut aussi se faire avec l' éditeur de texte Vim en ouvrant le fichier dans Vim, entrez :set nobomb, puis réenregistrez le. Si vous utilisez un Mac, TextEdit fera également le travail.

Pour plus d'informations sur la modification de, veuillez lire.

Simple wiki privé
Pour le cas d'utilisation habituel d'un "wiki privé, pour soi-même et approuvé pour les autres", vous devez :


 * restreindre l'affichage
 * restreindre les modifications
 * restreindre la création de comptes

En fonction des extensions que vous avez installées, vous pouvez mettre en liste blanche davantage de pages. Par exemple si vous utilisez l'extension, vous voulez éventuellement que Special:RequestAccount soit en liste blanche. Si la langue du contenu de votre wiki n'est pas l'anglais, il est possible que vous ayiez à utiliser le nom traduit des pages spéciales en question.

Restreindre la création de compte
Pour restreindre la création de compte, vous avez besoin de modifier LocalSettings.php dans le chemin de la racine de votre installation MediaWiki.


 * 1) aller à, lorsque vous serez connecté en tant qu'opérateur système.
 * 2) cliquer sur le lien "Créer un compte" pour arriver dans le formulaire de création de compte.
 * 3) entrer un nom d'utilisateur et une adresse de courriel, et cliquez sur le bouton "par courriel". Notez que vous avez besoin que sinon l'opérateur système doit choisir un mot de passe et l'envoyer à l'utilisateur.
 * 4) le compte sera créé avec un mot de passe aléatoire qui est ensuite envoyé par courriel à l'adresse indiquée (comme pour la fonction « mot de passe oublié » ). The user will be requested to change password at first login; when he does this, his e-mail address will also be marked as confirmed.
 * When you click the "create account" button instead, you have to manually send the user his password. If you've set (default configuration up to version 1.15) and you've left the password field blank, the user will be emailed an e-mail address confirmation request but will be unable to access  to perform the confirmation. Instead, the user will get an error (unless you've added it to ); the user will be able to login with a blank password and then confirm email, but their password will not have been reset (it will have to be reset manually).

It may be appropriate to edit the text displayed when a non-user attempts to log in. This can be done at MediaWiki:Nosuchuser, when logged in as a sysop. Use plain text without any special formatting, as the formatting is ignored and the text is literally rendered. (peuvent avoi changé, voir bug 12952).

You may also modify the contents of the e-mail sent to new users by editing the page MediaWiki:Createaccount-text.

Pour empêcher les opérateurs système de créer des comptes :

Pour ajouter un message en haut du formulaire de connexion, modifiez MediaWiki:Loginprompt. A la place, vous pouvez utiliser ce code dans votre LocalSettings.php:

Restreindre la modification de toutes les pages
Users will still be able to read pages with these modifications, and they can view the source by using Special:Export/Article name or other methods. Voir aussi bug 1859.

Voir et. If you use, any wiki admin can also put various restrictions in place.

Some examples of how to protect all pages from editing (not reading) by certain classes of users:

Restreindre les modifications anonymes
Requires that a user be registered before they can edit.

Restreindre les modifications aux utilisateurs administrateurs
Requires that a user be a member of the administrators (sysop) usergroup.

Restreindre la modification d'un espace de noms entier
Starting from MediaWiki version 1.10, it is possible to protect entire namespaces using the variable. Exemples:

Note that in the last case it's assumed that a custom namespace exists and that  is a defined constant equal to the namespace number. See Manual:Using custom namespaces and Manual:Namespace_constants for a list of MediaWiki's core namespaces.

Restreindre la modification de certaines pages spécifiques
Utiliser la fonctionalité de. Par défaut, tout opérateur système peut protéger les pages, donc uniquement les autres opérateurs système peuvent les modifier. In 1.9 and higher, by default they can also protect pages so only "autoconfirmed" users (with accounts older than a configured period) can edit them. Pas besoin de modifier les fichiers de configuration pour cela.

Si vous voulez restreindre les modifications aux groupes avec des droits spécifiques, modifiez. Pour empêcher les actions autres que la modification et le déplacement, utilisez.

Restreindre la modification de toutes sauf quelques pages
To impose a blanket restriction on editing for all pages, but allow a few (such as sandboxes, join request pages, etc.) to be more generously editable, you can use the extension. This may not fit too often, but you could also use the Restrict editing of certain specific pages method mentioned above, with all name spaces protected, and only a special one editable by everyone which has all the pages you want editable.

Restreindre la modification pour cetains intervalles d'adresses IP
Schools and other institutions may want to block all edits not from a few specified IP address ranges. Pour faire ceci, voir. The only way to do this at present without modifying the code is to go to Special:Blockip and systematically  every one of the address ranges that you don't want to be able to edit. Ceci fonctionnera avec toutes les versions futures de MediaWiki. Ceci ne fonctionnera pas selon l'espace de noms.

Restreindre le modification par un utilisateur particulier
Utiliser la fonctionalité de de l'utilisateur pour lui ôter tout droit d'accès en modification. MediaWiki does not include a possibility to give rights to separate users directly; instead rights are always given to a user group. There is no way in the core software to change permissions of particular users in order to restrict or allow editing particular pages, except by changing their usergroup.

Restriction de la création de pages dans certains espaces de noms
There are separate rights for creating talk pages (createtalk) and creating non-talk pages (createpage). If you need per-namespace control finer than that, it is not possible in core MediaWiki, and requires an extension such as.

Restreindre l'accès aux fichiers téléversés

 * &rarr;, , 

If you have enabled the ability to upload files, these will be served directly by the underlying web server. Comme résultat, .

Exemple de restriction d'accès aux fichiers téléversés dans la configuration du serveur
If sensitive files are uploaded to an internet-accessible wiki, you may wish to add restrictions on where these can be accessed from. On Apache, if your local network were 10.1.2.*, you could restrict serving files to local addresses with:

 Order deny,allow Allow from 10.1.2.3 Deny from all 

Restreindre l'affichage de toutes les pages
Add this line to your LocalSettings.php file:

The  setting allows users to view the main page. If page names have more than one word, use a space " " between them, not an underscore "_".

In addition to the main page of such a private site, you could give access to the Recentchanges page (if you think that its content isn't private) for feed readers by adding "Special:Recentchanges" to.

If you need to protect even the sidebar, main page, or login screen for any reason, it's recommended that you use higher-level authentication such as .htpasswd or equivalent.

Restreindre l'affichage de certaines pages spécifiques
To prevent anyone but sysops from viewing a page, it can simply be. To prevent even sysops from viewing it, it can be removed more permanently with extension. To completely destroy the text of the page, it can be manually removed from the database. In any case, the page cannot be edited while in this state, and for most purposes no longer exists.

To have a page act normally for some users but be invisible to others, as is possible for instance in most forum software, is a very different matter. MediaWiki is designed for two basic access modes:


 * 1) Everyone can view every single page on the wiki (with the possible exception of a few special pages). This is the mode used by Wikipedia and its sister projects.
 * 2) Anonymous users can only view the Main Page and login page, and cannot edit any page. This is basically the same as the above, in terms of technical implementation (just an extra check for every page view), which is why it exists. This is the mode of operation used by certain private wikis such as those used by various Wikimedia committees.

If you intend to have different view permissions than that, MediaWiki is not designed for your usage. (See bug 1924.) Data is not necessarily clearly delineated by namespace, page name, or other criteria, and there are a lot of leaks you'll have to plug if you want to make it so (see  for a sample). Other wiki software may be more suitable for your purpose. Vous avez été averti. If you must use MediaWiki, there are three basic possibilities:


 * 1) Set your wiki up private and whitelist specific pages that will be public with   in the LocalSetting.php file. See the section above.
 * 2) Set up separate wikis with a shared user database, configure one as viewable and one as unviewable (see above), and make interwiki links between them.
 * 3) Install a third-party hack or extension.  You will have to reapply it every time you upgrade the software, and it may not be updated immediately when new security fixes or upgrades of MediaWiki are released.  Third-party hacks are, of course, not supported by MediaWiki developers, and if you're having problems you shouldn't ask on MediaWiki-l, #mediawiki, or other official support channels. A number of hacks are listed in Category:Page specific user rights extensions. Read about security issues with authorization extensions if you plan to use one of those.

Restreindre l'exportation
Check also: Manual:Parameters_to_Special:Export

It is not possible to export the contents of a page that cannot be read since rev:19935.

Removing the Login link from all pages
One can remove the login/create account link from the upper right corner of all pages, as users can still go to Special:SpecialPages>Special:UserLogin to login. In LocalSettings.php use (tested with MediaWiki 1.16)

Removing accounts
If you want to completely remove access to a user, e.g. on a simple private wiki, it's not possible to simply delete the account (unless no edits have been made); you can block it, but the user will still be able to read pages. However, using User Merge and Delete extension you can merge the account in another one and delete the former; the original account will then "disappear". If you want to preserve history readability (i.e., to have edits from the user to be still shown under his name), you can create a new account e.g. with username "OriginalUserName (deactivated)" and then merge "OriginalUserName" into the former, or even use Renameuser extension to rename "OriginalUserName" into "AnotherUserName", then create an account under "OriginalUserName" and merge "AnotherUserName" into it: in this manner, "OriginalUserName" will be completely "usurped" (if you've set a non-null password).

Since MediaWiki 1.16.0, it is possible to set to true to prevent access and reading to blocked users.

Other restrictions
You may want to have pages editable only by their creator, or ban viewing of history, or any of a number of other things. None of these features are available in an unhacked version of MediaWiki. If you need more fine-grained permissions, see the #See also section for links to other wiki packages that are designed for this, as well as hacks that attempt to contort MediaWiki into something it's not designed to be but may work anyway.

Voir aussi
Il existe des pages relatives de manuel et d'aide qui peuvent avoir un intérêt pour vous :



Other wiki software may have better support for fine-grained access control than MediaWiki:


 * MoinMoin
 * - based on MediaWiki (limited documentation, small project)
 * TWiki
 * TikiWiki - has fully configuable access control to features and permission levels.

If you want better access control but want to use MediaWiki, this is a list of extensions and hacks to allow restrictions not possible in the software proper. These hacks may be out-of-date (check the version they're for). Please don't ask in official MediaWiki support channels if something goes wrong with a third-party hack.


 * (non-maintenu)
 * - restricts anonymous users from editing most pages
 * (non-maintenu)
 * (non-maintenu)
 * - restricts anonymous users from editing most pages
 * (non-maintenu)
 * - restricts anonymous users from editing most pages
 * (non-maintenu)
 * (non-maintenu)
 * (non-maintenu)


 * Extensions archivées