- Timestamp:
- 3 Jan 2008, 17:20:02 (17 years ago)
- Location:
- WAeUP_SRP/base
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPTool.py
r2959 r2975 98 98 wf_def = getattr(self.portal_workflow,wf_definition) 99 99 wf_def.updateRoleMappingsFor(ob) 100 ###) 101 102 security.declareProtected(View,'getAccessInfo') ###( 103 def getAccessInfo(self,context): 104 "return a dict with access_info" 105 logger = logging.getLogger('WAeUPTool.getAccessInfo') 106 mtool = self.portal_membership 107 member = mtool.getAuthenticatedMember() 108 member_id = str(member) 109 info = {} 110 is_anonymous = info['is_anonymous'] = mtool.isAnonymousUser() 111 is_student = info['is_student'] = ord(member_id[1]) > 48 and ord(member_id[1]) <= 57 112 is_staff = info['is_staff'] = not is_anonymous and not is_student 113 roles = member.getRolesInContext(context) 114 is_sectionofficer = info['is_sectionofficer'] = not is_student and ("SectionOfficer" in roles or 115 "SectionManager" in roles or 116 "Manager" in roles) 117 is_allowed = info['is_allowed'] = not is_anonymous 118 requested_id = context.getStudentId() 119 student_id = None 120 if not is_student and requested_id: 121 student_id = requested_id 122 elif is_anonymous or member_id != requested_id: 123 logger.info('%s tried to access %s of %s' % (member_id,context.portal_type,requested_id)) 124 else: 125 student_id = member_id 126 info['student_id'] = student_id 127 return info 100 128 ###) 101 129 -
WAeUP_SRP/base/skins/waeup_epayment/getPaymentInfo.py
r2058 r2975 21 21 pass 22 22 23 request = context.REQUEST24 mtool = context.portal_membership25 wf = context.portal_workflow26 member = mtool.getAuthenticatedMember()27 member_id = str(member)23 # request = context.REQUEST 24 # mtool = context.portal_membership 25 # wf = context.portal_workflow 26 # member = mtool.getAuthenticatedMember() 27 # member_id = str(member) 28 28 29 if mtool.isAnonymousUser(): 29 # if mtool.isAnonymousUser(): 30 # return None 31 # info = {} 32 # requested_id = context.getStudentId() 33 # if requested_id and not context.isStaff() and member_id != requested_id: 34 # logger.info('%s tried to access %s' % (member_id,requested_id)) 35 # return None 36 # elif context.isStaff(): 37 # student_id = requested_id 38 # else: 39 # student_id = member_id 40 info = context.waeup_tool.getAccessInfo(context) 41 student_id = info['student_id'] 42 if student_id is None: 30 43 return None 31 info = {}32 requested_id = context.getStudentId()33 if requested_id and not context.isStaff() and member_id != requested_id:34 logger.info('%s tried to access %s' % (member_id,requested_id))35 return None36 elif context.isStaff():37 student_id = requested_id38 else:39 student_id = member_id40 44 41 45 -
WAeUP_SRP/base/skins/waeup_student/getApplicationInfo.py
r2920 r2975 14 14 15 15 request = context.REQUEST 16 mtool = context.portal_membership 17 wf = context.portal_workflow 18 member = mtool.getAuthenticatedMember() 19 member_id = str(member) 20 path_info = request.get('PATH_INFO').split('/') 21 ##from Products.zdb import set_trace 22 ##set_trace() 23 if mtool.isAnonymousUser(): 16 # mtool = context.portal_membership 17 # wf = context.portal_workflow 18 # member = mtool.getAuthenticatedMember() 19 # member_id = str(member) 20 # path_info = request.get('PATH_INFO').split('/') 21 # ##from Products.zdb import set_trace 22 # ##set_trace() 23 # if mtool.isAnonymousUser(): 24 # return None 25 # info = {} 26 # requested_id = context.getStudentId() 27 # if requested_id and not context.isStaff() and member_id != requested_id: 28 # import logging 29 # logger = logging.getLogger('Skins.getApplicationInfo') 30 # logger.info('%s tried to access application object of %s' % (member_id,requested_id)) 31 # student_id = requested_id 32 # return None 33 # elif context.isStaff(): 34 # student_id = requested_id 35 # else: 36 # student_id = member_id 37 info = context.waeup_tool.getAccessInfo(context) 38 student_id = info['student_id'] 39 if student_id is None: 24 40 return None 25 info = {}26 requested_id = context.getStudentId()27 if requested_id and not context.isStaff() and member_id != requested_id:28 import logging29 logger = logging.getLogger('Skins.getApplicationInfo')30 logger.info('%s tried to access application object of %s' % (member_id,requested_id))31 student_id = requested_id32 return None33 elif context.isStaff():34 student_id = requested_id35 else:36 student_id = member_id37 41 38 42 info['has_passport'] = context.waeup_tool.picturesExist(('passport',), student_id) -
WAeUP_SRP/base/skins/waeup_student/getClearanceInfo.py
r2670 r2975 23 23 path_info = request.get('PATH_INFO').split('/') 24 24 25 if mtool.isAnonymousUser(): 25 # if mtool.isAnonymousUser(): 26 # return None 27 # info = {} 28 # #from Products.zdb import set_trace 29 # #set_trace() 30 # requested_id = context.getStudentId() 31 # if requested_id and not context.isStaff() and member_id != requested_id: 32 # logger.info('%s tried to access %s' % (member_id,requested_id)) 33 # return None 34 # elif context.isStaff(): 35 # student_id = requested_id 36 # else: 37 # student_id = member_id 38 39 info = context.waeup_tool.getAccessInfo(context) 40 student_id = info['student_id'] 41 if student_id is None: 26 42 return None 27 info = {}28 #from Products.zdb import set_trace29 #set_trace()30 requested_id = context.getStudentId()31 if requested_id and not context.isStaff() and member_id != requested_id:32 logger.info('%s tried to access %s' % (member_id,requested_id))33 return None34 elif context.isStaff():35 student_id = requested_id36 else:37 student_id = member_id38 39 43 40 44 students_object = context.portal_url.getPortalObject().campus.students -
WAeUP_SRP/base/skins/waeup_student/getStudentFolderInfo.py
r2961 r2975 35 35 36 36 37 info = {}38 37 member_id = str(member) 39 38 #from Products.zdb import set_trace;set_trace() 40 is_student = info['is_student'] = context.isStudent() 41 is_staff = info['is_staff'] = context.isStaff() 42 is_sectionofficer = info['is_sectionofficer'] = context.isSectionOfficer() 43 while True: 44 if mtool.isAnonymousUser(): 45 return None 46 requested_id = context.getStudentId() 47 if not is_student and requested_id: 48 student_id = requested_id 49 break 50 if member_id != requested_id: 51 logger.info('%s tried to access %s' % (member_id,requested_id)) 52 student_id = member_id 53 mtool.assertViewable(context) 54 break 55 student_id = member_id 56 break 39 # info = {} 40 # is_student = info['is_student'] = context.isStudent() 41 # is_staff = info['is_staff'] = context.isStaff() 42 # is_sectionofficer = info['is_sectionofficer'] = context.isSectionOfficer() 43 # while True: 44 # if mtool.isAnonymousUser(): 45 # return None 46 # requested_id = context.getStudentId() 47 # if not is_student and requested_id: 48 # student_id = requested_id 49 # break 50 # if member_id != requested_id: 51 # logger.info('%s tried to access %s' % (member_id,requested_id)) 52 # student_id = member_id 53 # mtool.assertViewable(context) 54 # break 55 # student_id = member_id 56 # break 57 info = context.waeup_tool.getAccessInfo(context) 58 student_id = info['student_id'] 59 if student_id is None: 60 return None 61 57 62 student_path_root = "%s/campus/students/%s" % (context.portal_url.getPortalPath(),student_id) 58 63 student_path = "%s/campus/students/%s" % (context.portal_url(),student_id) … … 102 107 row['type'] = subobject.portal_type 103 108 review_state = row['review_state'] = wf.getInfoFor(subobject,'review_state',None) 104 row['is_editable'] = (i s_student and review_state == "opened") or is_sectionofficer109 row['is_editable'] = (info['is_student'] and review_state == "opened") or info['is_sectionofficer'] 105 110 sv_link = s_view_links.get(subobject.portal_type,None) or "waeup_document_view" 106 111 row['s_view_link'] = "%s/%s" % (url,sv_link) -
WAeUP_SRP/base/skins/waeup_student/getStudyCourseInfo.py
r2876 r2975 30 30 31 31 wftool = context.portal_workflow 32 path_info = request.get('PATH_INFO').split('/')32 # path_info = request.get('PATH_INFO').split('/') 33 33 34 info = {} 35 info['is_so'] = context.isSectionOfficer() 34 # info = {} 35 info = context.waeup_tool.getAccessInfo(context) 36 student_id = info['student_id'] 37 if student_id is None: 38 return None 39 40 #info['is_so'] = context.isSectionOfficer() 41 info['is_so'] = info['is_sectionofficer'] 36 42 info['action'] = "%s" % context.absolute_url() 37 43 info['choosen_ids'] = request.get('ids',[]) 38 44 course = info['doc'] = context.getContent() 39 student_id = context.getStudentId()45 #student_id = context.getStudentId() 40 46 student_record = context.students_catalog.getRecordByKey(student_id) 41 47 if not student_record:
Note: See TracChangeset for help on using the changeset viewer.