I think the problem is you are passing a member to the changeOwnership
method, when it is expecting a user.
Knowing that user = member.getUser(), try your method using the user
object instead of the member one
Regards
--
Santi Camps
Earcon S.L. - http://www.earcon.com
- http://www.kmkey.com
On 2/22/07, Miguel Sánchez Beato <[EMAIL PROTECTED]> wrote:
Hi all. We're working on a customized CPS 3.4.2 and we want the
administrator to create users using a customized form (more than 20
fields). This form (once it has been filled) post the data to a
customized python script placed in one of our external products (not in
'custom' folder), this script has to create the entry in the directory
'members' (using some of the fieds of the posted form) and has to create
the member area (as it is done in the script 'logged_in.py') and some
special contents inside (curriculum, calendar, diary...).
Everything is going ok, until the member area creation: it creates the
member folder and its contents, but there are some problems with the
ownership of them. We have create a method that change the ownership to
the member that has been created (until now the owner of those resources
was the administrator, that is, the former creator). this is the code
(we have make it recursive to change the owner for every content inside
of the member area):
def changeRecursiveOwner(self, object, member):
"""Change the owner of an object and its contents
@param object: the object which to the owner is going to be
changed
@param member: the new owner
"""
object.changeOwnership(member)
recObjects = object.objectValues()
if recObjects:
for ob in recObjects:
self.changeRecursiveOwner(ob,member)
ob.manage_setLocalRoles(member.getId(),['Owner',])
ob.reindexObjectSecurity()
The owner changes, but it still doesn't seem to work ok: there are some
resources within the member area that are not accesible for the new
member, and it raises and error when we try to use the method
"getOwner()" in an expression like:
...
entry = dtool['members'].getEntry(doc.getOwner().getId())
...
that is used to create a guard for some of the widgets of the layouts
that support the new member data (and that have been filled in the
form).
The error is:
...
Module AccessControl.Owned, line 100, in getOwner
AttributeError: getUserById
...
Anybody knows somthing about this behavior?
Thanks a lot!
_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel
_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel