Use reindexObject to reindex metadata
This commit is contained in:
parent
f245f76cb5
commit
bdc8f9ffb8
|
@ -7,9 +7,6 @@ from Products.PluginIndexes.KeywordIndex.KeywordIndex import KeywordIndex
|
|||
from Products.CMFCore.utils import getToolByName
|
||||
|
||||
|
||||
SECURITY_INDEXES = ('allowedRolesAndUsers', 'enquirer', 'responsible')
|
||||
|
||||
|
||||
def all_principals_for_users(site, users):
|
||||
groups_and_users = set([])
|
||||
mtool = getToolByName(site, 'portal_membership')
|
||||
|
|
|
@ -3,7 +3,6 @@ from zope.interface import implements
|
|||
from plone.dexterity.content import Item
|
||||
|
||||
from collective.task.interfaces import IBaseTask
|
||||
from collective.task.catalog import SECURITY_INDEXES
|
||||
|
||||
|
||||
class IInformation(IBaseTask):
|
||||
|
@ -18,4 +17,3 @@ class Information(Item):
|
|||
meta_type = 'information'
|
||||
# disable local roles inheritance
|
||||
__ac_local_roles_block__ = True
|
||||
_cmf_security_indexes = SECURITY_INDEXES
|
||||
|
|
|
@ -3,7 +3,6 @@ from zope.interface import implements
|
|||
from plone.dexterity.content import Item
|
||||
|
||||
from collective.task.interfaces import IBaseTask
|
||||
from collective.task.catalog import SECURITY_INDEXES
|
||||
|
||||
|
||||
class IOpinion(IBaseTask):
|
||||
|
@ -18,4 +17,3 @@ class Opinion(Item):
|
|||
meta_type = 'opinion'
|
||||
# disable local roles inheritance
|
||||
__ac_local_roles_block__ = True
|
||||
_cmf_security_indexes = SECURITY_INDEXES
|
||||
|
|
|
@ -3,7 +3,6 @@ from zope.interface import implements
|
|||
from plone.dexterity.content import Container
|
||||
|
||||
from collective.task.interfaces import IBaseTask
|
||||
from collective.task.catalog import SECURITY_INDEXES
|
||||
|
||||
|
||||
class ITask(IBaseTask):
|
||||
|
@ -18,4 +17,3 @@ class Task(Container):
|
|||
meta_type = 'task'
|
||||
# disable local roles inheritance
|
||||
__ac_local_roles_block__ = True
|
||||
_cmf_security_indexes = SECURITY_INDEXES
|
||||
|
|
|
@ -3,7 +3,6 @@ from zope.interface import implements
|
|||
from plone.dexterity.content import Item
|
||||
|
||||
from collective.task.interfaces import IBaseTask
|
||||
from collective.task.catalog import SECURITY_INDEXES
|
||||
|
||||
|
||||
class IValidation(IBaseTask):
|
||||
|
@ -18,4 +17,3 @@ class Validation(Item):
|
|||
meta_type = 'validation'
|
||||
# disable local roles inheritance
|
||||
__ac_local_roles_block__ = True
|
||||
_cmf_security_indexes = SECURITY_INDEXES
|
||||
|
|
|
@ -19,7 +19,7 @@ def grant_local_role_to_responsible(context, role, target):
|
|||
"""Grant local role to responsible on target"""
|
||||
responsible = context.responsible[0]
|
||||
target.manage_addLocalRoles(responsible, [role])
|
||||
target.reindexObjectSecurity()
|
||||
target.reindexObject()
|
||||
|
||||
|
||||
@grok.subscribe(ITask, IAfterTransitionEvent)
|
||||
|
@ -53,7 +53,7 @@ def set_enquirer(context, event):
|
|||
enquirer = api.user.get_current().id
|
||||
enquirer_dm = LocalRolesToPrincipalsDataManager(context, IBaseTask['enquirer'])
|
||||
enquirer_dm.set((enquirer,))
|
||||
context.reindexObjectSecurity()
|
||||
context.reindexObject()
|
||||
|
||||
|
||||
@grok.subscribe(ITarget, IObjectAddedEvent)
|
||||
|
|
Reference in New Issue