# The following script collects email addresses of those users
# who have 'View' access to an obect. I use it in a Notify workflow
contentObject = state_change.object
mailList=[]
for thisMember in context.portal_membership.listMembers():
if thisMember.listed and thisMember.email:
try:
if not contentObject.acquiredRolesAreUsedBy( 'View' ):
for p in contentObject.rolesOfPermission( 'View' ):
if p['selected']:
if p['name'] in thisMember.getRolesInContext(contentObject):
mailList.append(thisMember.email)
else:
mailList.append(thisMember.email)
except:
pass
|