## Script (Python) "get_searchable_student_states" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=key=None ##title= ## # $Id: get_searchable_student_states.py 1871 2007-06-08 18:57:59Z henrik $ """ return the searchable student_states depending on context """ wftool = context.portal_workflow mtool = context.portal_membership member = mtool.getAuthenticatedMember() roles = member.getRolesInContext(context) voc = context.portal_vocabularies.searchable_student_states if key is not None: return voc.get(key) if "ClearanceOfficers" in member.getGroups(): return [item for item in voc.items() if item[0].startswith('clear') or item[0] in ("all",)] elif "CourseAdvisers" in member.getGroups(): return [item for item in voc.items() if item[0].startswith('courses') or item[0] in ("all",)] return voc.items()