Partial example:
{{{
def application(environ, start_response):
# Make sure usernames are lower case...
environ['REMOTE_USER'] = environ['REMOTE_USER'].lower()
# Strip any domain if present (should only ever be one)
while "\\" in environ['REMOTE_USER']:
environ['REMOTE_USER'] = environ['REMOTE_USER'].split("\\", 1)[1]
# Do lookup here...
environ['trac.env_parent_dir'] = r'/parent/path'
return trac.web.main.dispatch_request(environ, start_response)
}}}
If that doesn't work for you, you could take all your trac instances offline and run some SQL statements to update all of the data records with the new values. I suspect this could be a lot of work but there may well be plugins at trac-hacks.org to help with some of this (something like batchmodifyplugin for example).
~ mark c