[Zope-CMF] trivial new portal folder type gives weird workflow/security behavior?

Carl Rendell cer@sol43.com
Tue, 1 Oct 2002 09:01:47 -0700


After some additional testing. This modified content_status_modify 
script seems to do the trick on preventing anonymous users from 
accessing unpublished or not effective content within a folderish 
object that is published. Chris and others may want to do more 
testing as well.

BTW, I was having some difficulty getting this to work until I 
reindexed the catalog.

My final version of the content_status_modify script takes care of 
the reindexing of sub objects, and the '/view' issue.

## Script (Python) "content_status_modify"
##parameters=workflow_action, comment=''
##title=Modify the status of a content object

context.portal_workflow.doActionFor(
     context,
     workflow_action,
     comment=comment)

view = '/view'

# added to allow for workflow controlled folders
if context.isPrincipiaFolderish:
	view = ''
	context.reindexObjectSecurity()

if workflow_action == 'reject':
	redirect_url = context.portal_url() + '/search?review_state=pending'
else:
	redirect_url = '%s%s?%s' % ( context.absolute_url()
		                       , view
		                       , 'portal_status_message=Status+changed.'
		                       )

context.REQUEST[ 'RESPONSE' ].redirect( redirect_url )