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

Randall Kern randy@teamkern.net
Wed, 29 Nov 2000 18:12:33 -0800


This is a multi-part message in MIME format.

------=_NextPart_000_163C_01C05A2F.F2174D30
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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

------=_NextPart_000_163C_01C05A2F.F2174D30
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2920.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I wish to restrict the creation of a =
class=20
(SpokeSite) to people with the "Add Spoke Site" permission, and in turn =
only=20
provide that permission to people in the 'Super-manager' =
Role.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>When I call =
ProductContext.registerClass for my=20
SpokeSite class, I can pass the permission argument with the tuple ('Add =
Spoke=20
Site', 'Super-manager'), which does a good job of limiting the =
availability of=20
my class (just as I desire).</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>However, I would like my Product to =
automatically=20
create the 'Super-manager' Role, if it doesn't exists.&nbsp; The bad =
part is=20
that this role needs to be added before any of my objects exist, which =
makes it=20
hard...</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I've got it *working* by cheating, and =
using the=20
private __app attribute of the ProductContext.&nbsp; Is there a better =
way for=20
python Products to alter the Zope installation (add Roles, create =
Folders, etc.)=20
during installation?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>-Randy</FONT></DIV></BODY></HTML>

------=_NextPart_000_163C_01C05A2F.F2174D30--