Extension:NSFileRepo

The NSFileRepo extension restricts access to upload and read files and images to a given set of user groups associated with protected namespaces. Using this extension (within the security limitations noted above), you can protect not only pages and areas of your wiki, but also any uploaded images or files within those namespaces.

Namespaces are mechanism for grouping/separating wiki pages.


 * See Help:Namespaces for more user help documentation on what they are and how they are used.
 * See Manual:Namespace for system administration details on MediaWiki's namespace feature
 * See Project:Namespaces for an explanation of how namespaces are used on mediawiki.org

Usage
Generically, you use the same syntax as a normal file reference link, adding the namespace between the file specifier ("File", "Image" or "Media") and the file name:

{FILE_NS}:{Namespace}:{Filename}

Example (where  is the protected namespace and   is the file to which you wish to limit access):



The standard for accessing files is generally: [[Media:Filename.jpg]]

This extension allows you to protect access to files by adding the namespace text identifier after the file namespace identifier, for example (where  is the protected namespace and   is the file to which you wish to limit access): [[Media:Private:Filename.jpg]]

It may be helpful to understand the default security model used by MediaWiki using the instructions below:


 * Manual:User rights
 * Manual:$wgGroupPermissions

Limitations of security are the same as for Extension:Lockdown. To review these limitations, see here.

To use the full capabilities of this extension (for example, specific namespace protections) you will need to install and use the namespace protections provided through Extension:Lockdown.

This extension was made possible by the introduction of Repository Classes by Tim Starling - an elegant and brilliant implementation. It uses a new Local Repository class mechanism. Technical details on how this extension works can be found here.

Installation
This extension requires the Lockdown extension to be installed first.

When working with  and later, you will need to create a symlink of   within your mediawiki installation directory

On Linux use ln -s extensions/NSFileRepo/nsfr_img_auth.php On Windows use mklink nsfr_img_auth.php extensions\NSFileRepo\nsfr_img_auth.php Also make sure to set a proper value for. E.G.:

Configuration
The user rights and configuration requiremements are are the same as described in Extension Lockdown.

Troubleshooting IIS / UTF-8 encoding
In some unspecified constellations you will have problems by opening files with special characters using nsfr_img_auth.php. The problem was seen by using Windows Server 2012 R2 with IIS 8.5 and PHP 7.2.14. It seems to be a problem with UTF-8 encoding.

You can use this hook as workaround to solve this:

Just put it in the LocalSettings.php and the problem should be solved.