Back to index

plone3  3.1.7
folder_localrole_add.py
Go to the documentation of this file.
00001 ## Script (Python) "folder_localrole_add"
00002 ##parameters=member_ids=(), member_roles=()
00003 ##title=Set local roles
00004 ##
00005 
00006 from Products.CMFPlone.utils import transaction_note
00007 from Products.CMFPlone import PloneMessageFactory as _
00008 
00009 pm = context.portal_membership
00010 
00011 for member_role in member_roles:
00012     pm.setLocalRoles( obj=context,
00013                       member_ids=member_ids,
00014                       member_role=member_role,
00015                       reindex=False,
00016                       REQUEST=context.REQUEST)
00017 context.reindexObjectSecurity()
00018 
00019 transaction_note('Modified sharing for folder %s at %s' % (context.title_or_id(), context.absolute_url()))
00020 context.plone_utils.addPortalMessage(_(u'Local roles changed.'))
00021 
00022 context.REQUEST.RESPONSE.redirect(context.absolute_url() + '/folder_localrole_form')