How to hide the ‘Error: Forbidden’ message for anonymous Trac users

In order to keep a Trac instance entirely private except for authenticated users, it is common practice to remove the WIKI_VIEW permissions for anonymous users. When this is done however, a new user arriving at the Trac instance will be greeted with a rather unfriendly message:

Error: Forbidden

WIKI_VIEW privileges are required to perform this operation on WikiStart

A more user-friendly welcome might be to instead redirect unauthenticated users to the login prompt to enter their login credentials, thereby avoiding the unfriendly error message. It is possible to enable this by activating the TracPermRedirect plugin in your Trac instance.

How to enable the TracPermRedirect plugin

This plugin is already installed at ProjectHut, so all you need to do is enable it. You can do this by following these steps:

  1. Create a User using the ProjectHut Control Panel (i.e. the admin/ area of your account).
  2. Assign TRAC_ADMIN permissions to the User by using the Trac Permissions page of the Control Panel.
  3. Login to the Trac instance as the TRAC_ADMIN User, and click on the Admin tab.
  4. Click on Plugins to view the list of plugins.
  5. Click on the TracPermRedirect 2.0 plugin to expand the selection options.
  6. Check the PermRedirectModule component to enable it.
  7. Click on Apply Changes to activate the plugin.

With this plugin now enabled, all new unauthenticated visitors to your Trac instance will be automatically redirected to the login prompt, thereby avoiding the unfriendly “Error: Forbidden” message.



  0 COMMENTS

Leave a Reply

Resources