# MediaWiki

## Restricting user access to editing or creating pages

By default, MediaWiki allows all users of all levels to create pages and edit pages, as well as add to discussion pages. Before we can show how to restrict this, it will be important to know a little bit about user levels:

• * means anyone, whether a registered user or not.

• user means anyone who went to the 'create account' page and gave themselves a username. Since this process is more or less automated and not subject to admin approval, user could be any random person from anywhere.

• sysop means privileged operators who can change settings from the Special Pages of the mediawiki. this would probably be you, if you are helping to manage a MediaWiki.

You can restrict access by adding the following kinds of statements to the bottom of your LocalSettings.php file. These are given as examples:

• The following line prevents random users from creating accounts for themselves:

$wgGroupPermissions['*']['createaccount'] = false; • The following lines restrict editing of wiki pages by anyone except wiki administrators:$wgGroupPermissions['*']['edit'] = false;

$wgGroupPermissions['user']['edit'] = false;$wgGroupPermissions['sysop']['edit'] = true;

• The following lines restrict the creation of new pages; only wiki admins can do it:

$wgGroupPermissions['*']['createpage'] = false;$wgGroupPermissions['*']['createtalk'] = false;

$wgGroupPermissions['user']['createpage'] = false;$wgGroupPermissions['sysop']['createpage'] = true;

• The following line prevents non-registered users from deleting pages:

$wgGroupPermissions['*']['delete'] = false; • The following lines restrict the uploading of files or content except to admins:$wgGroupPermissions['*']['upload'] = false;

$wgGroupPermissions['user']['upload'] = false;$wgGroupPermissions['user']['reupload'] = false;

$wgGroupPermissions['sysop']['upload'] = true; ## Adding Math Support with MathJax The "traditional" math support for MediaWiki has been a math extension based on texvc. As of MediaWiki 1.19 and later, support is available for an alternative math rendering system, which is much easier to install and configure. This MediaWiki extension is based on MathJax. ### Installing MediaWiki math support based on the MathJax extension 1. First enter the extensions folder and create a new folder called MathJax (case sensitive). 2. As of September 2012, two source files need to be installed in this folder. They are available HERE. • I would suggest simply use wget to download these into the folder. • You should end up with two files installed, MathJax.php and mwMathJaxConfig.js. 3. You will need to install MathJax locally; it will not work with the default (nonlocal access) behavior. • Create a directory called mathjax in your web root (check your httpd.conf file to see whether this is, for example, /var/www or /var/www/mediawiki or some other thing!) • Obtain MathJax; this will probably be a zip file. Unzip into the mathjax directory. • Test the installation: point your browser to http://{yoursite.com}/mathjax/test. The test page should load and render successfully. 4. Edit your LocalSettings.php to include the following lines in this order (at the bottom): require_once("$IP/extensions/MathJax/MathJax.php");

MathJax_Parser::$MathJaxJS = '/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML';$wgUseMathJax = true;

5. In MediaWiki version 1.19 you need to add the following line right after the MathJax_Parser statement:

$wgParserCacheType = CACHE_NONE; • A few notes: • It does not matter if you have$wgUseTeX set to true or false.

• You cannot use $IP in the path given to the MathJax_Parser statement above. • You can disable MathJax parsing by including __NOMATHJAX__ at the top of a wiki page. • By default, MathJax parses TeX-style math between the following characters: •  •$ ... \$ and $$...$$

• \begin{align} ... \end{align}  statements

• You can disable parsing between single-dollar signs by including __MATHJAX_NODOLLAR__ at the top of a wiki page.

MediaWiki (last edited 2013-04-08 20:15:26 by localhost)