I used this in a view class which mass-changes ownership:
def changeOwnership(self, obj, userid):
""" Change ownership of obj to userid """
membership = getToolByName(self.context, 'portal_membership')
user = membership.getMemberById(userid)
roles = list(obj.get_local_roles_for_userid(userid))
if 'Owner' not in roles:
I had a look at the internals of plone.app.changeownership to find out what i had to do in order to make this work.