[Zope] Changing ownership...
Josef Meile
jmeile@hotmail.com
Thu, 10 Jan 2002 19:36:47 +0100
This is a multi-part message in MIME format.
------=_NextPart_000_0005_01C19A0E.24880C40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I'm using the following method to change the ownership of an Object:
from AccessControl.Owned import Owned
def changeOwner(pObject,pUserFolder,pUsername=3D''):
userObject=3DpUserFolder.getUser(pUsername).__of__(pUserFolder)
pObject.changeOwnership(userObject)
Owned.changeOwnership(pObject,userObject,recursive=3D1)
And I call it as follows:
<dtml-call "REQUEST.set(objectValue,
REQUEST.resolve_url('www.myurl.com/myFolder'))">
<dtml-call "changeOwner(objectValue,acl_users,'tester')">
The above solution changes the ownership of the folder and the objects =
inside of it (I can see it on the manage interface). My problem now is =
that I get the following error whenever I try to edit an object that I =
own:
Site Error
An error was encountered while publishing this resource.=20
Unauthorized
You are not authorized to access indexObject.
Why do I get this message if I own the object which I want to modify?=20
It doesn't happen if I create a new object rather than transfer the=20
ownership. What am doing wrong?
Thanks in advanced,
Josef.
------=_NextPart_000_0005_01C19A0E.24880C40
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 http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I'm using the following method to =
change the=20
ownership of an Object:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>from AccessControl.Owned import =
Owned</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>def=20
changeOwner(pObject,pUserFolder,pUsername=3D''):<BR> =20
userObject=3DpUserFolder.getUser(pUsername).__of__(pUserFolder)<BR> =
=20
pObject.changeOwnership(userObject)<BR> =20
Owned.changeOwnership(pObject,userObject,recursive=3D1)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>And I call it as follows:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><dtml-call=20
"REQUEST.set(objectValue,<BR> &n=
bsp; =20
REQUEST.resolve_url('www.myurl.com/myFolder'))"><BR><dtml-call=20
"changeOwner(objectValue,acl_users,'tester')"></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The above solution changes the =
ownership of the=20
folder and the objects inside of it (I can see it on the manage =
interface). My=20
problem now is that I get the following error whenever I try to edit an =
object=20
that I own:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Site Error<BR>An error was encountered =
while=20
publishing this resource. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Unauthorized<BR>You are not authorized =
to access=20
indexObject.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Why do I get this message if I own the =
object which=20
I want to modify? <BR>It doesn't happen if I create a new object rather =
than=20
transfer the <BR>ownership. What am doing wrong?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in=20
advanced,<BR>Josef.</FONT></DIV></BODY></HTML>
------=_NextPart_000_0005_01C19A0E.24880C40--