[Zope] Managing local roles with a script
Etienne Labuschagne
ELabuschane@gmsonline.co.za
Tue, 12 Nov 2002 20:25:41 +0200
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C28A78.E801B5D0
Content-Type: text/plain;
charset="iso-8859-1"
I have a CMF site. In the site there are three folders, A, B and C which I
call products. To view a product you need the "Broker" role.
I want to be able to "accredit" a user for any combination of product A, B
and C. Thus I wrote a script, assigning the local Role "Broker" to a user
for the folder A, B or C (according to his accreditation).
This works fine.
I also want to be able to remove the accreditation. So I wrote a script
that removes the local roles for those accreditations that were removed.
My problem is with the removing. The script has proxy role Manager, Broker
(and just about anything else by now!) but I cannot get it to remove the
roles.
In the script I have tried:
productFolder.manage_delLocalRoles([userId])
AND
context.portal_membership.deleteLocalRoles(productFolder, [userId])
Out of the source I understand why the latter doesn't work - it ignores
proxy roles and uses manage_delLocalRoles anyway. Why doesn't the first one
also not work? Does it also ignore proxy roles? The script works if I am
logged in as "Manager", but I want a "BrokerManager" user to also be able to
use this script without giving him full "Manager" rights.
B.t.w. the above fails silently, no exception, the role removal just doesn't
happen.
Thanks
Etienne
------_=_NextPart_001_01C28A78.E801B5D0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>Managing local roles with a script</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2>I have a CMF site. In the site there are three =
folders, A, B and C which I call products. To view a product you =
need the "Broker" role.</FONT></P>
<P><FONT SIZE=3D2>I want to be able to "accredit" a user for =
any combination of product A, B and C. Thus I wrote a script, =
assigning the local Role "Broker" to a user for the folder A, =
B or C (according to his accreditation).</FONT></P>
<P><FONT SIZE=3D2>This works fine.</FONT>
</P>
<P><FONT SIZE=3D2>I also want to be able to remove the =
accreditation. So I wrote a script that removes the local roles =
for those accreditations that were removed.</FONT></P>
<P><FONT SIZE=3D2>My problem is with the removing. The script has =
proxy role Manager, Broker (and just about anything else by now!) but I =
cannot get it to remove the roles.</FONT></P>
<P><FONT SIZE=3D2>In the script I have tried: </FONT>
</P>
<P><FONT SIZE=3D2>productFolder.manage_delLocalRoles([userId]) </FONT>
<BR><FONT SIZE=3D2>AND</FONT>
<BR><FONT =
SIZE=3D2>context.portal_membership.deleteLocalRoles(productFolder, =
[userId])</FONT>
</P>
<P><FONT SIZE=3D2>Out of the source I understand why the latter doesn't =
work - it ignores proxy roles and uses manage_delLocalRoles =
anyway. Why doesn't the first one also not work? Does it =
also ignore proxy roles? The script works if I am logged in as =
"Manager", but I want a "BrokerManager" user to =
also be able to use this script without giving him full =
"Manager" rights.</FONT></P>
<P><FONT SIZE=3D2>B.t.w. the above fails silently, no exception, the =
role removal just doesn't happen.</FONT>
</P>
<P><FONT SIZE=3D2>Thanks</FONT>
<BR><FONT SIZE=3D2>Etienne</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C28A78.E801B5D0--