Ticket #5730 (closed Bug: fixed)
changeOwnership wrongly complains: Only retrievable users in this site can be made owners.
|Reported by:||maurits||Owned by:|
When programmatically calling changeOwnership on an object and giving it a userid that exists in the root acl_users of Zope (not Plone), it raises a KeyError, 'Only retrievable users in this site can be made owners.' This is because it only looks in the acl_users of the plone portal, not Zope. This fixes that:
maurits@mauritsvanrees:~/svn/plone2.5-zope29/CMFPlone $ svn diff Index: PloneTool.py =================================================================== --- PloneTool.py (revision 10368) +++ PloneTool.py (working copy) @@ -440,7 +440,9 @@ acl_users = getattr(self, 'acl_users') user = acl_users.getUserById(userid) if user is None: - raise KeyError, 'Only retrievable users in this site can be made owners.' + user = membership.getMemberById(userid) + if user is None: + raise KeyError, 'Only retrievable users in this site can be made owners.' object.changeOwnership(user, recursive) def fixOwnerRole(object, user_id):
Note that this KeyError won't be triggered TTW: in the change ownership form of the sharing tab a user in the root acl_users (e.g. the creator of the Zope instance) will not be listed. This is related to bug https://dev.plone.org/plone/ticket/5727 that I reported yesterday and which turned out not to be a bug in Plone. So maybe I just want to do too much crazy stuff, but I think this fix should be fine.