Logo Search packages:      
Sourcecode: zope-cmfmember version File versions  Download package

def CMFMember::tools::memberdatacontainer::MemberDataContainer::fixOwnership (   self  ) 

A utility method for transferring ownership for users who no longer
exist

Definition at line 220 of file memberdatacontainer.py.

00220                           :
        """
        A utility method for transferring ownership for users who no longer
        exist
        """

        portal = getToolByName(self, 'portal_url').getPortalObject()
        catalog = getToolByName(self, 'portal_catalog')

        missing_users = []

        users = catalog.uniqueValuesFor('indexedOwner')
        for u in users:
            sp = u.split('/')
            user_id = sp[-1]
            path = '/'.join(sp[:-1])
            acl_users = portal.unrestrictedTraverse(path)
            user = acl_users.getUser(user_id)
            if user is None:
                missing_users.append(user_id)

        reindex = []
        for u in missing_users:
            ownedObjects = catalog.search({'indexedOwner':u})

            for o in ownedObjects:
                object = o.getObject()
                if object is not None and object != self:
                    if self.handleOrphanedContent(object):
                        reindex.append(object)

        for o in reindex:
            o.reindexObject()


    def handleOrphanedContent(self, object, new_user=None):


Generated by  Doxygen 1.6.0   Back to index