Changeset 7240 for main/waeup.sirp/trunk/src/waeup/sirp/students
- Timestamp:
- 30 Nov 2011, 23:13:26 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/authentication.py
r7233 r7240 60 60 61 61 @property 62 def user_type(self): 63 return u'student' 64 65 @property 62 66 def description(self): 63 67 return self.title … … 126 130 return None 127 131 account = self.getAccount(credentials['login']) 128 129 132 if account is None: 130 133 return None … … 135 138 description=account.description, 136 139 email=account.email, 137 phone=account.phone) 140 phone=account.phone, 141 user_type=account.user_type) 138 142 139 143 def principalInfo(self, id): … … 266 270 """ 267 271 grok.implements(IAuthPluginUtility) 272 grok.name('students_auth_setup') 268 273 269 274 def register(self, pau): -
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r7234 r7240 161 161 grok.context(IStudentsContainer) 162 162 grok.name('index') 163 grok.require('waeup.viewStudents ')163 grok.require('waeup.viewStudentsContainer') 164 164 grok.template('containerpage') 165 165 label = 'Student Section' … … 381 381 email_from = self.config.email_admin 382 382 username = self.request.principal.id 383 usertype = self.request.principal.user_type.title() 383 384 body = data['body'] 384 385 #subject = u'Mail from SIRP' 385 386 subject = data['subject'] 386 387 email_to = self.context.email 387 success = send_mail(fullname,username, self.config.name,388 success = send_mail(fullname,username,usertype,self.config.name, 388 389 body,email_from,email_to,subject) 389 390 if success: … … 1271 1272 return 1272 1273 1273 @property1274 def is_student(self):1275 prm = get_principal_role_manager()1276 roles = [x[0] for x in prm.getRolesForPrincipal(self.request.principal.id)]1277 return 'waeup.Student' in roles1278 1279 1274 @grok.action('Remove selected') 1280 1275 def delBedTickets(self, **data): 1281 if self.is_student:1276 if getattr(self.request.principal, 'user_type', None) == 'student': 1282 1277 self.flash('You are not allowed to remove bed tickets.') 1283 1278 self.redirect(self.url(self.context)) … … 1305 1300 def selected_actions(self): 1306 1301 sa = self.actions 1307 if self.is_student:1302 if getattr(self.request.principal, 'user_type', None) == 'student': 1308 1303 sa = [action for action in self.actions 1309 1304 if not action.label in self.officers_only_actions] -
main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/accommodationmanagepage.pt
r7017 r7240 18 18 <thead> 19 19 <tr> 20 <th tal:condition="not: view/is_student"> </th>20 <th tal:condition="not: layout/isStudent"> </th> 21 21 <th>Session</th> 22 22 <th>Booking Date</th> … … 27 27 <tbody> 28 28 <tr tal:repeat="cl context/values"> 29 <td tal:condition="not: view/is_student">29 <td tal:condition="not: layout/isStudent"> 30 30 <input type="checkbox" 31 31 name="val_id" -
main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
r7221 r7240 123 123 124 124 student_id = schema.TextLine( 125 title = u'Student I D',125 title = u'Student Id', 126 126 required = False, 127 127 ) -
main/waeup.sirp/trunk/src/waeup/sirp/students/permissions.py
r7201 r7240 29 29 grok.name('waeup.viewStudent') 30 30 31 class ViewStudents(grok.Permission): 32 grok.name('waeup.viewStudents') 31 class ViewStudentsTab(grok.Permission): 32 grok.name('waeup.viewStudentsTab') 33 34 class ViewMyStudentDataTab(grok.Permission): 35 grok.name('waeup.viewMyStudentDataTab') 36 37 class ViewStudentsContainer(grok.Permission): 38 grok.name('waeup.viewStudentsContainer') 33 39 34 40 class PayStudent(grok.Permission): … … 58 64 class StudentRole(grok.Role): 59 65 grok.name('waeup.Student') 60 grok.permissions('waeup.viewAcademics' )66 grok.permissions('waeup.viewAcademics', 'waeup.viewMyStudentDataTab') 61 67 62 68 class StudentsOfficer(grok.Role): 63 69 grok.name('waeup.StudentsOfficer') 64 70 grok.title(u'Students Officer (view only)') 65 grok.permissions('waeup.viewStudent','waeup.viewStudents') 71 grok.permissions('waeup.viewStudent','waeup.viewStudents', 72 'waeup.viewStudentsTab', 'waeup.viewStudentsContainer') 66 73 67 74 class StudentsManager(grok.Role): -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r7218 r7240 693 693 self.browser.getControl(name="form.password").value = 'mrclearsecret' 694 694 self.browser.getControl("Login").click() 695 self.assert True('You logged in' inself.browser.contents)695 self.assertMatches('...You logged in...', self.browser.contents) 696 696 # CO can see his roles 697 697 self.browser.getLink("My Roles").click() -
main/waeup.sirp/trunk/src/waeup/sirp/students/viewlets.py
r7191 r7240 163 163 grok.context(IWAeUPObject) 164 164 grok.order(4) 165 grok.require('waeup.viewStudents ')165 grok.require('waeup.viewStudentsTab') 166 166 grok.template('primarynavtab') 167 167 … … 200 200 return '' 201 201 202 #class HomeTab(PrimaryStudentNavTab): 203 # """Home-tab in primary navigation. 204 # """ 205 # grok.order(1) 206 # grok.require('waeup.Authenticated') 207 # pnav = 0 208 # tab_title = u'Home' 209 210 #class ProspectusTab(PrimaryStudentNavTab): 211 # """Faculties-tab in primary navigation. 212 # """ 213 # grok.order(2) 214 # grok.require('waeup.viewAcademics') 215 # pnav = 1 216 # tab_title = u'Prospectus' 217 218 # @property 219 # def link_target(self): 220 # return self.view.application_url('faculties') 221 222 class MyDataTab(PrimaryStudentNavTab): 202 class MyStudentDataTab(PrimaryStudentNavTab): 223 203 """MyData-tab in primary navigation. 224 204 """ 225 205 grok.order(3) 226 grok.require('waeup. Authenticated')206 grok.require('waeup.viewMyStudentDataTab') 227 207 pnav = 4 228 208 tab_title = u'My Data'
Note: See TracChangeset for help on using the changeset viewer.