Nidelven IT - All about Python, Zope & Plone - and Open Source!

Here you'll find issues related to our services. Mostly about Python, Zope and Plone, as well as hosting-related issues.

"Keeping IT real"

Older entries

Atom - Subscribe - Categories
Previous | Next

Automating Plone setups - Faking a Zope user

So I've setup our Plone demo site,

again after a long hiatus. It includes a script to setup Plone instances automatically as users register with their email address.

In that process I discovered that the Plone installation (setup) scripts stopped working properly if an unauthenticated user was running the External Method that sets up the sites (workflowexception, no action for object).

After a little thinking I figured that the problem might be the login status of the user registering as the registration was working fine when being run by the admin (logged-in) user.

So I created this script:

Which overrides the standard security context and enables one to fake a Zope user from an acl_users folder, or simply fake a system user such as system or nobody.

The product won't change the actual logged-in (or anonymous user) for example when looking at the undo tab, but it does the trick for the workflow machinery which accepts whatever user you select or specify when calling FakeZopeUser.FakeUser.

[Update, demo site now works as it should, so try again if it didn't]

[Permalink] [By morphex] [Python, Zope, Plone - and anything loosely related to that (Atom feed)] [2012 05 Mar 09:33 GMT+2]



By: Matthew Wilkes

Manipulating private attributes of the security manager like this is a bad idea, just use newSecurityManager with the user you want to move into, and then move back to the old security manager when you're done.

The documentation on this is here:

I don't recommend anyone use this product over the existing API.

Add comment (text format)


A passphrase is required to comment on this weblog. It is required to make sure that bots aren't doing automatic spamming. It is: nit is the best!.