You need to configure the workflow as shown below:
- go to Zope-> portal_workflow management interface
- Create a new state, say, βTrailerβ (this is optional, you can set up an existing state instead ... maybe a private state would be a good option to deal with restrictions for certain users / groups)
- Remove all permissions except "Access Content Information" from an anonymous user in this particular state.
- Click the "Update Security Settings" button.
Done! Now all content in the Trailer state will be searchable, but will not be displayed by anonymous users.
Note. If you decide to create a new state, as I would say, be sure to add all the necessary transitions.
Edit
Unfortunately, I did not know that in recent versions of Plone, a new index appeared in the portal_catalog portal ( allowedRolesAndUsers ), which prevents the process described above from working as before. The above process is still valid, although you need to override the default index index. First create a new pasteur package using the "plone" template. Then add to the main level of the package (e.g. my.package / my / package) a file called indexers.py
with this:
from zope.interface import Interface from plone.indexer.decorator import indexer from AccessControl.PermissionRole import rolesForPermissionOn from Products.CMFCore.utils import getToolByName from Products.CMFCore.CatalogTool import _mergedLocalRoles @indexer(Interface) def allowedRolesAndUsers(obj): """Return a list of roles and users with View permission. Used by PortalCatalog to filter out items you're not allowed to see. """ allowed = {} for r in rolesForPermissionOn('Access contents information', obj): allowed[r] = 1
and then at the same level add the overrides.zcml
file with this:
<configure xmlns="http://namespaces.zope.org/zope"> <adapter factory=".indexers.allowedRolesAndUsers" name="allowedRolesAndUsers" /> </configure>
At the end, your product tree should look like this:
my.package/ βββ my β βββ __init__.py β βββ package β βββ configure.zcml β βββ overrides.zcml β βββ indexers.py β βββ __init__.py β βββ profiles β β βββ default β β βββ metadata.xml β βββ tests.py βββ README.txt βββ setup.cfg βββ setup.py
In the latter case, you need to include the newly created egg in buildout.cfg:
eggs = my.package develop = src/my.package
Reassembly. It's all.
source share