def updateDiscussionStates(portal):
    """
    search all discussions in the portal and update security info.
    """
    catalog = portal.portal_catalog
    brains = catalog(portal_type="Discussion Item")
    wftool = getMultiAdapter((portal, portal.REQUEST), name=u"plone_tools").workflow()
    for brain in brains:
        obj = brain.getObject()
        chain = wftool.getChainFor(obj)
        if chain:
            wf_id = chain[0]
            wf = wftool.getWorkflowById(wf_id)
            wf.updateRoleMappingsFor(obj)
            obj.reindexObjectSecurity()
    logger.info("updated workflow for %d Discussion Items" % len(brains))
Exemple #2
0
def updateDiscussionStates(portal):
    """
    search all discussions in the portal and update security info.
    """
    catalog = portal.portal_catalog
    brains = catalog(portal_type="Discussion Item")
    wftool = getMultiAdapter((portal, portal.REQUEST),
                             name=u"plone_tools").workflow()
    for brain in brains:
        obj = brain.getObject()
        chain = wftool.getChainFor(obj)
        if chain:
            wf_id = chain[0]
            wf = wftool.getWorkflowById(wf_id)
            wf.updateRoleMappingsFor(obj)
            obj.reindexObjectSecurity()
    logger.info("updated workflow for %d Discussion Items" % len(brains))
def to_1_1_0(context):
    """
    Create new workflows for comments, and update existing comments
    """
    logger.info('Upgrading collective.portlet.discussion to version 1.1.0')
    context.runImportStepFromProfile(default_profile, 'workflow')
    logger.info('Reinstalled workflow.xml')
    wftool = getMultiAdapter((context, context.REQUEST), name=u"plone_tools").workflow()
    brains = context.portal_catalog(portal_type="Discussion Item")
    for brain in brains:
        obj = brain.getObject()
        chain = wftool.getChainFor(obj)
        if chain:
            wf_id = chain[0]
            wf = wftool.getWorkflowById(wf_id)
            wf.updateRoleMappingsFor(obj)
            obj.reindexObjectSecurity()
    logger.info("updated %d Discussion Items" % len(brains))
Exemple #4
0
def to_1_1_0(context):
    """
    Create new workflows for comments, and update existing comments
    """
    logger.info('Upgrading collective.portlet.discussion to version 1.1.0')
    context.runImportStepFromProfile(default_profile, 'workflow')
    logger.info('Reinstalled workflow.xml')
    wftool = getMultiAdapter((context, context.REQUEST),
                             name=u"plone_tools").workflow()
    brains = context.portal_catalog(portal_type="Discussion Item")
    for brain in brains:
        obj = brain.getObject()
        chain = wftool.getChainFor(obj)
        if chain:
            wf_id = chain[0]
            wf = wftool.getWorkflowById(wf_id)
            wf.updateRoleMappingsFor(obj)
            obj.reindexObjectSecurity()
    logger.info("updated %d Discussion Items" % len(brains))