lunedì 9 novembre 2009

[HOWTO] Trac AccountManagerPlugin

I've just installed AccountManager Trac plugin in one of my trac instances (in this howto i will name it "xyz").


repo:/tmp# svn co http://trac-hacks.org/svn/accountmanagerplugin/0.11 .
repo:/tmp# cd 0.11
repo:/tmp/0.11# python setup.py bdist_egg
repo:/tmp/0.11# cd dist/
repo:/tmp/0.11/dist# mv TracAccountManager-*.egg /path/to/trac/xyz/plugins/


In xyz/conf/trac.ini i have added:


[components]
trac.web.auth.LoginModule = disabled
acct_mgr.web_ui.LoginModule = enabled
acct_mgr.web_ui.RegistrationModule = disabled
acct_mgr.web_ui.emailverificationmodule = disabled
acct_mgr.htfile.HtPasswdStore = enabled

[account-manager]
password_store = HtPasswdStore
password_file = /path/to/trac/xyz/conf/trac.htpasswd


Then i had to edit my apache httpd configuration. On this server i run several trac instances (with the TracEnvParentDir set to /path/to/trac/ ) so my login configuration was:


<Location "/trac/*/login">
    AuthType Basic
    AuthName "Login"
    AuthUserFile /etc/httpd/conf/htpasswd
    Require valid-user
</Location>


Then it became:


<Location ~ /trac/(?!xyz)*/login">
    AuthType Basic
    AuthName "Login"
    AuthUserFile /etc/httpd/conf/htpasswd
    Require valid-user
</Location>


Adding that regex, now i exclude from this directive the path /trac/xyz/login.
Consequently the form login (handled by the AccountManagementPlugin) is only available in xyz instance (with a reserved password file), while the others (including future ones) will use the apache basic authentication.

Nessun commento: