Ticket #5730 (closed Bug: fixed)

Opened 8 years ago

Last modified 5 years ago

changeOwnership wrongly complains: Only retrievable users in this site can be made owners.

Reported by: maurits Owned by:
Priority: minor Milestone: 3.1.5
Component: General Version:
Keywords: Cc:

Description

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.

Change History

comment:1 Changed 6 years ago by maurits

Fixed in r22072 of branch 3.1 and r22073 of trunk.

comment:2 Changed 6 years ago by maurits

  • Status changed from new to closed
  • Resolution set to fixed

comment:3 Changed 5 years ago by hannosch

  • Component changed from Permissions to Infrastructure

comment:4 Changed 22 months ago by davisagli

  • Component changed from Infrastructure to General
Note: See TracTickets for help on using tickets.