[Zope] adding roles to Zope in Product.initialize()

Chris McDonough chrism@digicool.com
Wed, 29 Nov 2000 22:09:02 -0500


No... the stock answer is "use local roles".  I had a proposal up to create
an interface for programmatically adding roles on dev.zope.org but it's
quite dead.  The thought behind this is that actual roles are reserved for
administrator usage, not developer usage.  Which leaves us in sort of this
weird state that I'm not completely comfortable with, but don't have time to
argue. :-)

----- Original Message -----
From: Randall Kern
To: zope@zope.org
Sent: Wednesday, November 29, 2000 9:12 PM
Subject: [Zope] adding roles to Zope in Product.initialize()


I wish to restrict the creation of a class (SpokeSite) to people with the
"Add Spoke Site" permission, and in turn only provide that permission to
people in the 'Super-manager' Role.

When I call ProductContext.registerClass for my SpokeSite class, I can pass
the permission argument with the tuple ('Add Spoke Site', 'Super-manager'),
which does a good job of limiting the availability of my class (just as I
desire).

However, I would like my Product to automatically create the 'Super-manager'
Role, if it doesn't exists.  The bad part is that this role needs to be
added before any of my objects exist, which makes it hard...

I've got it *working* by cheating, and using the private __app attribute of
the ProductContext.  Is there a better way for python Products to alter the
Zope installation (add Roles, create Folders, etc.) during installation?

Thanks!
-Randy