Search code examples
plonedexterityplone-4.x

Changing ownership of an object does not give permissions to the new owner


My application automatically creates contents when an object's workflow state is changed. But this new content is created with the user changing the state as the owner. I would like to give ownership to another user. The new user is indeed owner, but he doesn't have the permission to edit the content. It is a custom dexterity content type.

I tried this:

company.changeOwnership(mtool.getMemberById(context.username))
company.manage_setLocalRoles(context.username, ['Owner'])
company.setCreators([context.username])
company.reindexObjectSecurity()

Is something missing ? The only information I found was this script, but the creator said he had to set the permissions using the @@sharing view.

Thanks.


Solution

  • I found the solution. The parent folder was internally published and thus the object, having no workflow, acquired the folder. Which means it couldn't be modified.