Extension:NSFileRepo/DOC

Specifying Namespace
This extension will allow one, and only one, namespace in the Title/link specification, and that namespace must be the text version of a declared custom namespace (NS_INDEX >= 100). So if a custom namespace has been declared in the LocalSettings file, e.g.:

Then you could use the standard namespace protections (with some very specific capabilites if you use Extension:Lockdown).

For example:



Multiple NameSpaces?
Nope, sorry. If you tried to use multiple namespaces, the standard "replace : with _" rule would be applied.

Example:



Would be translated to:



Will this work with foreign repositories?
Foreign repositories will work the same way they always have. NameSpace protections will apply only to the local repository. Attempts to reference non-local repositories will be handled by those repositories' classes the same way they are now. This is for local repositories only, and I have no immediate plans for implementing a cross-system access protection vehicle.

Technically - How does this work?
When Tim Starling redesigned the file repository system, he architected a solution that supported a single "local" repository with an additional array of "foreign" repositories. MW first looks in the Local repository, then using the foreign repository classes, searches sequentially through those repositories until the file is found. If you are interested in studying a brilliant concept and superb execution, this is a textbook case and studying the MS repo system is well worth a purely academic pursuit.

NSFileRepo is a class extension of LocalRepo and its associated LocalFile classes. All reference parsing is done within these classes so I was able to extend them to override and process as needed for this extension.

Additionally, the extension uses the Extension:Lockdown capabilities developed by Duesentrieb to give the same granular access protection to files/images as are provided through other NameSpace features.

Changes to the Local Directory Structure
In the default Local Repository, files are process/stored in the following structures: {hash}/ temp/{hash}/ archive/{hash}/

. ..

If a valid custom namespace is specified for the file, the namespace index is prepended in the directory structure, e.g. {ns}/{hash}/ temp/{ns}/{hash}/ archive/{ns}/{hash}/

. ..

The hook added to img_auth.php looks at the first directory in the hash structure and sees if it is an integer > 100 (as all custom namespaces must be). If so, it translates the index into text, builds a title with that namespace text, and checks to see if access is authorized.

An additional value to this would be the ability to set specific access restrictions on these directories (and sub directories) that could further restrict access by those with administrative access to the actual server.