40b93c06a2f7409bb86d6dd0c6b057c036572ba9
[Plinn.git] / profiles / default / workflows / member_workflow / scripts / before_register.py
1 ## Script (Python) "before_register"
2 ##bind container=container
3 ##bind context=context
4 ##bind namespace=
5 ##bind script=script
6 ##bind subpath=traverse_subpath
7 ##parameters=sci
8 ##title=
9 ##
10 portal = sci.getPortal()
11 member = sci.object
12
13
14 from Products.Plinn.RegistrationTool import DEFAULT_MEMBER_GROUP
15 from Products.CMFCore.utils import getToolByName
16
17 gtool = getToolByName(portal, 'portal_groups')
18 mtool = getToolByName(portal, 'portal_membership')
19
20
21 if gtool.getGroupById(DEFAULT_MEMBER_GROUP) is None :
22 gtool.addGroup(DEFAULT_MEMBER_GROUP)
23 aclu = portal.acl_users
24 aclu.changeUser(aclu.getGroupPrefix() + DEFAULT_MEMBER_GROUP, roles=['Member', ])
25
26 g = gtool.getGroupById(DEFAULT_MEMBER_GROUP)
27 g.addMember(member.getId())