[Moin-user] Fun with user_autocreate

Thomas Waldmann tw-public at gmx.de
Fri Feb 24 09:31:05 EST 2006


> I'm trying to get my head around the program architecture at
> the moment, and I'm hoping that someone can explain this to me.
> Currently I'm using moin-1.5.1,

For development it is best to use a current version, that means at least 
the latest release, better a tla checkout.

> and I'm modifying it to support
> HTTP authentication via LDAP (specifically, Active Directory)

auth against AD / LDAP is already done in recent patchlevels.

In my implementation, it still uses the cookie to stay "logged in".

> in standalone mode.  That bit works.  Additionally, what I'm
> trying to is to have the wiki auto create the account when the
> person has logged in for the first time (using the cn and email
> AD attributes).  The bit that's not working for me is that I
> have "user_autocreate = True" set in the config, but by the
> time User's create_or_update() method has been called,
> user_autocreate is false.

That sounds strange. X)
Checked for typos? Maybe you assigned it twice in your configs?

> I guess this is where my confusion
> kicks in; the cfg attribute in RequestStandAlone/RequestBase
> (which in turn is passed to User()) is coming from multiconfig.

MoinMoin/multiconfig.py just has the defaults (and some code to load 
configs). Never change stuff there, only change YOUR farmconfig.py or 
wikiconfig.py.

> I can't see how the startup configuration would ever get to
> the request, even though they're both instances of Config().

multiconfig.py imports your configuration - either by importing and 
using your farmconfig, going through the wikis list, checking what 
config module it shall load for the current request URL. Or, if no 
farmconfig.py is there, it will load wikiconfig.py and use it for any URL.

> Did I miss something in the install?  (All the Wiki doco
> regarding user_autocreate seems to imply just stick it in
> the Config class and it should work).

If you are doing your own auth method, you of course have to have the 
usual few code lines at the end of your auth method calling the 
create_or_update method, see those other auth methods.

> Any help to unbend my head would be greatly appreciated.

Join us on IRC #moin channel.





More information about the Moin-user mailing list