source: WAeUP_SRP/base/skins/waeup_student/getIdCardInfo.py @ 3671

Last change on this file since 3671 was 2047, checked in by Henrik Bettermann, 17 years ago

id card demo can now only be used by the following members:

'admin','isouaba','obadejo','joachim','babu','taiyelabegan'

File size: 1.7 KB
Line 
1## Script (Python) "getIdCardInfo"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=
9##
10# $Id: getTransferInfo.py 1339 2007-01-21 22:55:34Z henrik $
11"""
12return Info about the current Student
13"""
14import logging
15logger = logging.getLogger('Skins.getIdCardInfo')
16from DateTime import DateTime
17
18request = context.REQUEST
19mtool = context.portal_membership
20wf = context.portal_workflow
21member = mtool.getAuthenticatedMember()
22member_id = str(member)
23
24
25if member_id not in ('admin','isouaba','obadejo','joachim','babu','taiyelabegan'):
26    return None
27
28if mtool.isAnonymousUser():
29    return None
30info = {}
31#from Products.zdb import set_trace
32#set_trace()
33requested_id = context.getStudentId()
34if requested_id and not context.isStaff() and member_id != requested_id:
35    logger.info('%s tried to access %s' % (member_id,requested_id))
36    return None
37elif context.isStaff():
38    student_id = requested_id
39else:
40    student_id = member_id
41
42
43students_object = context.portal_url.getPortalObject().campus.students
44student = getattr(students_object,student_id)
45
46res = context.students_catalog(id = student_id)
47if len(res) != 1:
48    return None
49sbrain = res[0]
50info['id'] = student_id
51info['scatalog'] = context.getFormattedStudentEntry(sbrain)
52info['student'] = student
53#info['entry_mode'] = sbrain.entry_mode
54
55personal = getattr(student,'personal',None)
56if personal:
57    personal_doc = personal.getContent()
58    info['personal'] = personal_doc
59
60#cert_id = sbrain.course
61#res = context.portal_catalog(portal_type = "Certificate", id = cert_id)
62#if res:
63#    brain = res[0]
64#    info['sc_title'] = brain.Title
65
66return info
Note: See TracBrowser for help on using the repository browser.