Extension:ImageRefer

From MediaWiki.org
Jump to: navigation, search


MediaWiki extensions manual - list
Crystal Clear action run.png
ImageRefer

Release status: beta

Implementation User rights
Description Extension for controlling image access based on the values of Semantic MediaWiki properties of the page where the image is inserted
Author(s) Toni Hermoso Pulido (Tonihertalk)
Last version 0.1
MediaWiki 1.16, 1.17?
PHP 5.2.x, 5.3.x
License GPLv2 or higher
Download Git Repository
Check usage and version matrix

Contents

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]