Example #1
0
 def _getPortrait(self, member_id):
     uf = getToolByName(self, 'acl_users')
     user = uf.getUserById(member_id)
     if user is None:
         return BaseTool._getPortrait(self, member_id)
     portrait = user.getProperty('portrait', None)
     if portrait is None:
         return BaseTool._getPortrait(self, member_id)
     return portrait
Example #2
0
 def _getPortrait(self, member_id):
     uf = getToolByName(self, 'acl_users')
     user = uf.getUserById(member_id)
     if user is None:
         return BaseTool._getPortrait(self, member_id)
     portrait = user.getProperty('portrait', None)
     if portrait is None:
         return BaseTool._getPortrait(self, member_id)
     return portrait
Example #3
0
 def wrapUser(self, user):
     """
     If possible, returns the Member object that corresponds to the
     given User object.
     """
     mbtool = getToolByName(self, 'membrane_tool')
     mem = mbtool.getUserAuthProvider(user.getId())
     if mem is None:
         return BaseTool.wrapUser(self, user)
     return mem.__of__(self).__of__(user)
Example #4
0
 def wrapUser(self, user):
     """
     If possible, returns the Member object that corresponds to the
     given User object.
     """
     mbtool = getToolByName(self, 'membrane_tool')
     mem = mbtool.getUserObject(user.getUserName())
     if mem is None:
         return BaseTool.wrapUser(self, user)
     return mem.__of__(self).__of__(user)
 def __init__(self, **kwargs):
     atapi.BaseBTreeFolder.__init__(self, self.id, **kwargs)
     BaseTool.__init__(self)
     self.setTitle('gcommons Users')
     self.unindexObject()
 def __init__(self, **kwargs):
     atapi.BaseBTreeFolder.__init__(self, self.id, **kwargs)
     BaseTool.__init__(self)
     self.setTitle('gcommons Users')                                                                                                            
     self.unindexObject()                                                                                                                                            
Example #7
0
 def __init__(self, **kwargs):
     atapi.BaseBTreeFolder.__init__(self, self.id, **kwargs)
     BaseTool.__init__(self)
     self.title = 'Member Profiles'
Example #8
0
def migrateMemberDataTool(portal, out):
    print >> out, ("MemberData Tool (portal_memberdata) from "
                   "CMFMember to remember")

    print >> out, " ...move MemberData Tool to temporary folder"
    unrestricted_move(portal.cmfmember_tmp, portal.portal_memberdata)

    ps_out = []
    installPortalSetup(portal, ps_out)
    print >> out, '\n'.join(ps_out)

    # Need CMFMember Member Type Info out of the way for GenericSetup
    # steps
    pt = getToolByName(portal, 'portal_types')
    wft = getToolByName(portal, 'portal_workflow')

    mig_map_values = MIGRATION_MAP.values()

    print >> out, " ...moving old member types and workflows out of the way"
    for info in mig_map_values:
        mem_type = info['atct_newTypeFor']['portal_type']
        chain = wft.getChainForPortalType(mem_type)
        info['chain'] = chain
        unrestricted_move(portal.cmfmember_tmp, getattr(pt, mem_type))
        if info.get('replace_workflows', False):
            wf_ids = info['workflow_ids']
            for wf_id in wf_ids:
                wft._delObject(wf_id)

    ps = getToolByName(portal, 'portal_setup')
    qi = getToolByName(portal, 'portal_quickinstaller')

    # need to instantiate a default MemberDataTool since changes to
    # GenericSetup mean the membrane profile is no longer doing so,
    # but it will fail if there isn't one
    if portal._getOb('portal_memberdata', None) is None:
        mdtool = MemberDataTool()
        portal._setObject('portal_memberdata', mdtool)

    print >> out, " ...applying membrane profile"
    ps.setImportContext('profile-CMFPlone:plone')
    ps.setImportContext('profile-membrane:default')
    ps.runAllImportSteps()

    print >> out, " ...applying new member implementation profiles"
    for info in mig_map_values:
        profile = info.get('profile', None)
        product = info.get('product', None)
        if profile is not None:
            ps.setImportContext(profile)
            ps.runAllImportSteps()
        elif product is not None:
            # use a QI install method instead
            if not qi.isProductInstalled(product):
                qi.installProduct(product)
            else:
                qi.reinstallProducts([product])

    print >> out, " ...restoring old member types"
    # Needed for the actual member migration
    for info in mig_map_values:
        mem_type = info['atct_newTypeFor']['portal_type']
        unrestricted_move(pt, getattr(portal.cmfmember_tmp, mem_type))
        wft.setChainForPortalTypes((mem_type, ), info['chain'])

    if hasattr(aq_base(portal.cmfmember_tmp.portal_memberdata), '_actions'):
        print >> out, " ...migrating actions"
        actions = portal.cmfmember_tmp.portal_memberdata._actions
        portal.portal_memberdata._actions = actions

    print >> out, " ...migrating data"
    mdtool = portal.cmfmember_tmp.portal_memberdata
    properties = mdtool._properties
    for elt in properties:
        elt['value'] = mdtool.getProperty(elt['id'])
        updateProp(portal.portal_memberdata, elt)

    print >> out, " ...done"
Example #9
0
 def __init__(self, **kwargs):
     atapi.BaseBTreeFolder.__init__(self, self.id, **kwargs)
     BaseTool.__init__(self)
     self.title = 'Member Profiles'
Example #10
0
def migrateMemberDataTool(portal, out):
    print >> out, ("MemberData Tool (portal_memberdata) from "
                   "CMFMember to remember")

    print >> out, " ...move MemberData Tool to temporary folder"
    unrestricted_move(portal.cmfmember_tmp, portal.portal_memberdata)

    ps_out = []
    installPortalSetup(portal, ps_out)
    print >> out, '\n'.join(ps_out)

    # Need CMFMember Member Type Info out of the way for GenericSetup
    # steps
    pt = getToolByName(portal, 'portal_types')
    wft = getToolByName(portal, 'portal_workflow')

    mig_map_values = MIGRATION_MAP.values()

    print >> out, " ...moving old member types and workflows out of the way"
    for info in mig_map_values:
        mem_type = info['atct_newTypeFor']['portal_type']
        chain = wft.getChainForPortalType(mem_type)
        info['chain'] = chain
        unrestricted_move(portal.cmfmember_tmp,
                          getattr(pt, mem_type))
        if info.get('replace_workflows', False):
            wf_ids = info['workflow_ids']
            for wf_id in wf_ids:
                wft._delObject(wf_id)

    ps = getToolByName(portal, 'portal_setup')
    qi = getToolByName(portal, 'portal_quickinstaller')

    # need to instantiate a default MemberDataTool since changes to
    # GenericSetup mean the membrane profile is no longer doing so,
    # but it will fail if there isn't one
    if portal._getOb('portal_memberdata', None) is None:
        mdtool = MemberDataTool()
        portal._setObject('portal_memberdata', mdtool)

    print >> out, " ...applying membrane profile"
    ps.setImportContext('profile-CMFPlone:plone')
    ps.setImportContext('profile-membrane:default')
    ps.runAllImportSteps()

    print >> out, " ...applying new member implementation profiles"
    for info in mig_map_values:
        profile = info.get('profile', None)
        product = info.get('product', None)
        if profile is not None:
            ps.setImportContext(profile)
            ps.runAllImportSteps()
        elif product is not None:
            # use a QI install method instead
            if not qi.isProductInstalled(product):
                qi.installProduct(product)
            else:
                qi.reinstallProducts([product])

    print >> out, " ...restoring old member types"
    # Needed for the actual member migration
    for info in mig_map_values:
        mem_type = info['atct_newTypeFor']['portal_type']
        unrestricted_move(pt, getattr(portal.cmfmember_tmp, mem_type))
        wft.setChainForPortalTypes((mem_type,), info['chain'])

    if hasattr(aq_base(portal.cmfmember_tmp.portal_memberdata),
               '_actions'):
        print >> out, " ...migrating actions"
        actions = portal.cmfmember_tmp.portal_memberdata._actions
        portal.portal_memberdata._actions = actions

    print >> out, " ...migrating data"
    mdtool = portal.cmfmember_tmp.portal_memberdata
    properties = mdtool._properties
    for elt in properties:
        elt['value'] = mdtool.getProperty(elt['id'])
        updateProp(portal.portal_memberdata, elt)

    print >> out, " ...done"