Extension:ImageRefer

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
ImageRefer

Release status:Extension status beta

ImplementationTemplate:Extension#type User rights
DescriptionTemplate:Extension#description Extension for controlling image access based on the values of Semantic MediaWiki properties of the page where the image is inserted
Author(s)Template:Extension#username Toni Hermoso Pulido (Tonihertalk)
Latest versionTemplate:Extension#version 0.1
MediaWikiTemplate:Extension#mediawiki 1.16, 1.17?
PHPTemplate:Extension#php 5.2.x, 5.3.x
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download Git Repository

Translate the ImageRefer extension if it is available at translatewiki.net

Check usage and version matrix.

Usage[edit]

This extension is part of Lab Service Wiki, developed thanks to CRG. You need to have image authorization properly set up (see below).

Installation[edit]

To install this extension, add the following to LocalSettings.php:

require_once("$IP/extensions/ImageRefer/ImageRefer.php");
$ImageReferAssociatedUsers = "Request from"; //Change for string type property
$ImageReferAssociatedAllowed = "Visible"; //Change for boolean type property
$ImageReferAllowedUsers = "Viewer"; //Change for string type property
$ImageReferRights = array('sysop'); // Sysops can access to any image (add more values if necessary)

Configuration parameters[edit]

If we want to restrict user access using a string property that contains a username (eg. the creator of the page associated to the image) and a boolean one which enables or disables their access, we need to add these two parameters in LocalSettings.php. Their values are the properties used.

  • $ImageReferAssociatedUsers = "Request from"; -- String type property (change 'Request from' with suitable one). It can be a username (for instance the creator of the page associated to the image).
  • $ImageReferAssociatedAllowed = "Visible"; -- Boolean property (change 'Visible' with suitable one).

Parallelly or alternately, we can use a string property that can contain a list of users (comma separated) that will be granted direct access

  • $ImageReferAllowedUsers = "Viewer"; -- String type property (change 'Viewer' with suitable one)

User rights[edit]

We can define which users can overcome image restriction access by adding associated groups to the following array:

  • $ImageReferRights = array('sysop', 'team'); -- sysop and team groups overcome image restriction.

TODO[edit]

  • Make it more easily customizable.
  • Instead of comma-separated $ImageReferAllowedUsers, make it accept other separators by using another parameter.

See also[edit]