Back to index

plone3  3.1.7
folder_localrole_edit.py
Go to the documentation of this file.
00001 ##parameters=change_type
00002 ##title=Set local roles
00003 ##
00004 from Products.CMFCore.utils import getToolByName
00005 from Products.CMFDefault.utils import Message as _
00006 
00007 mtool = getToolByName(script, 'portal_membership')
00008 
00009 if change_type == 'add':
00010     mtool.setLocalRoles(obj=context,
00011                         member_ids=context.REQUEST.get('member_ids', ()),
00012                         member_role=context.REQUEST.get('member_role', ''),
00013                         REQUEST=context.REQUEST)
00014 else:
00015     mtool.deleteLocalRoles(obj=context,
00016                            member_ids=context.REQUEST.get('member_ids', ()),
00017                            REQUEST=context.REQUEST)
00018 
00019 context.setStatus(True, _(u'Local Roles changed.'))
00020 context.setRedirect(context, 'object/localroles')