Skip to main content

A Trac plugin to allow access to static documents

Project description

Staticdocs Plugin for Trac

The staticdocs-plugin allows one to serve a directory of static web documents through trac. The motivation for writing this was to be able to control access to static files (e.g. project documentation) using trac’s authentication and authorization system.

Requirements

This has been tested under trac 0.12. It may well work in earlier versions. It probably requires python >= 2.6.

Configuration

Somewhere in your trac configs put a section like:

[staticdocs]

# (Optional) Set the required permission for viewing static docs
# The default is WIKI_VIEW
permission         = WIKI_VIEW

# Set up some aliases (you need at least one alias for this plugin
# to be worthwhile.)
alias./docs/       = /path/to/docs/
alias./docs/other/ = /path/to/other/docs/

# (Optional) Override the required permission for a specific alias
permission./docs/other/  = TICKET_VIEW

Also, you will want to enable the plugin. Probably like this:

[components]

staticdocsplugin.* = enabled

Now if you visit, e.g., http://example.com/yourtrac/docs/file.html, you will get served the file /path/to/docs/file.html.

Notes, Possible Buglets

Hidden and backup files

Any requests for URLs which have a path component starting with . or ending with ~ will result in a 404 Not Found response.

(Any request with a path component of .. will result in a 400 Bad Request response.)

Content Types

Currently, mimetype.guess_type is used to deduced the content type.

Directory Indexes

If the URL ends in a slash, index.html is added. This should probably be fixed so as to look for index.htm as well.

Other Hints

The NavAddPlugin (from trac-hacks) will let you add links to your static docs (or anywhere else) to the trac navigation bar.

The standard ExtraPermissionsProvider plugin can be used to add a new custom permission (say STATIC_DOCS_VIEW) if you would like one to control access to your static files.

Author

Jeff Dairiki.

Changes

Release 0.1 (2012-02-14)

Happy Valentine’s Day!

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

staticdocs-plugin-0.1.tar.gz (7.3 kB view details)

Uploaded Source

File details

Details for the file staticdocs-plugin-0.1.tar.gz.

File metadata

File hashes

Hashes for staticdocs-plugin-0.1.tar.gz
Algorithm Hash digest
SHA256 e1a0d31b31a99c7dee5d7ee5af283a2edf4cd6ef9ef5872327b33f779bcd5e73
MD5 f826a6fe950ae130da505b186cdadb66
BLAKE2b-256 8de9004b4410087fe88e27e1f757f2d63da981ceb6c4843d0f01e319c2cda238

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page