Hi folks,

I'm struggling with some Zope 3 startup code. I registered a user like
this for the Session Credentials plugin and login form stuff:


    def create(self, data):
        site = getSite()
        sm = site.getSiteManager()

        if sm.has_key('auth'):
            return "Site is already set up"

        pau = Pluggableauth()
        sm['auth'] = pau
        sm.registerUtility(pau, Iauth)
        users = PrincipalFolder()
        sm['auth']['Users'] = users
        sm.registerUtility(users, IAuthenticatorPlugin, name="Users")
        pau.authenticatorPlugins = (users.__name__, )
        pau.credentialsPlugins = ("No Challenge if Authenticated",
                                  "Session Credentials")

        user = InternalPrincipal("user", "foo", "user",
        users["user"] = user


This also works fine, but when I restart the server, the permissions are
gone. Now I want to call the permission granting on Zope startup (when
the startup is complete).
I traced a possible solution to subscribe to the IProcessStartupEvent
event, but I'm a bit lost how to implement it.

Now I have a few questions:

0. Is there a simple way to make this permission granting persistent?

1. Is there some example code somewhere of someone who did something
like this before (run stuff on startup)?

2. Does this code run when the server is fully initialized, or before.
Obviously putting it in the __init__.py is no use, because it is called
before the core services are online.

- Seth

Sebastian Bartos, <seth.kriti...@googlemail.com>
keyserevr: pgp.mit.edu

Attachment: signature.asc
Description: This is a digitally signed message part

Zope3-users mailing list

Reply via email to