Changeset 14992 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 26 Apr 2018, 08:50:56 (7 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py
r14939 r14992 61 61 IPasswordValidator, IContactForm, IKofaUtils, ICSVExporter, 62 62 academic_sessions_vocab, DOCLINK, registration_states_vocab) 63 from waeup.kofa.university.department import Department 64 from waeup.kofa.university.course import Course 63 65 from waeup.kofa.permissions import ( 64 66 get_users_with_local_roles, get_all_roles, get_all_users, … … 1011 1013 @property 1012 1014 def getCourses(self): 1015 courses = [] 1013 1016 local_roles = get_user_account(self.request).getLocalRoles() 1014 return local_roles['waeup.local.Lecturer'] 1017 for item in local_roles.get('waeup.local.Lecturer', []): 1018 if isinstance(item, Course): 1019 courses.append(item) 1020 elif isinstance(item, Department): 1021 courses += [i for i in item.courses.values()] 1022 return courses 1015 1023 1016 1024 # -
main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/mycourses.pt
r13908 r14992 5 5 <div tal:repeat="course view/getCourses"> 6 6 <a tal:attributes="href python:view.url(course)"> 7 <span tal:content="course/title">ROLE</span> 8 (<span tal:content="course/code">ROLE</span>) 7 <span tal:content="python:course.__parent__.__parent__.__parent__.code">FAC</span> / 8 <span tal:content="python:course.__parent__.__parent__.code">DEP</span> / 9 <span tal:content="course/longtitle">COURSE</span> 9 10 </a> 10 11 </div> -
main/waeup.kofa/trunk/src/waeup/kofa/permissions.py
r14949 r14992 205 205 206 206 207 class DepartmentOfficer(grok.Role): 208 """The local DepartmentOfficer role can be assigned at faculty or 209 department level. The role allows to list all student data within the 210 faculty/department the local role is assigned. 211 """ 212 grok.name('waeup.local.DepartmentOfficer') 213 grok.title(u'Department Officer') 214 grok.permissions('waeup.showStudents', 215 'waeup.viewAcademics', 216 'waeup.exportPaymentsOverview') 217 218 207 219 class DepartmentManager(grok.Role): 208 220 """The local DepartmentManager role can be assigned at faculty or … … 218 230 'waeup.showStudents', 219 231 'waeup.exportData') 220 221 222 class DepartmentOfficer(grok.Role):223 """The local DepartmentOfficer role can be assigned at faculty or224 department level. The role allows to list all student data within the225 faculty/department the local role is assigned.226 227 Department Managers (Dean of Faculty or Head of Department respectively)228 can also list student data but not access student pages. They can229 furthermore export payment overviews.230 """231 grok.name('waeup.local.DepartmentOfficer')232 grok.title(u'Department Officer')233 grok.permissions('waeup.showStudents',234 'waeup.viewAcademics',235 'waeup.exportPaymentsOverview')236 232 237 233 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r14896 r14992 3980 3980 self.student['studycourse'].addStudentStudyLevel( 3981 3981 self.certificate, studylevel) 3982 # Assign local Lecturer role for a c ertificate.3982 # Assign local Lecturer role for a course. 3983 3983 course = self.app['faculties']['fac1']['dep1'].courses['COURSE1'] 3984 3984 prmlocal = IPrincipalRoleManager(course) … … 4011 4011 self.assertMatches('...You logged in...', self.browser.contents) 4012 4012 self.assertEqual(self.browser.url, URL_LECTURER_LANDING) 4013 self.assertTrue( 4014 "<span>Unnamed Course (COURSE1)</span>" 4015 in self.browser.contents) 4016 4017 def test_lecturer_department_role(self): 4018 # lecturers can login and will be led to landing page also if 4019 # role is assigned at department level. 4020 self.login_as_lecturer() 4021 # we remove the role granted above 4022 course = self.app['faculties']['fac1']['dep1'].courses['COURSE1'] 4023 prmlocal = IPrincipalRoleManager(course) 4024 prmlocal.removeRoleFromPrincipal('waeup.local.Lecturer', 'mrslecturer') 4025 notify(LocalRoleSetEvent( 4026 course, 'waeup.local.Lecturer', 'mrslecturer', granted=False)) 4027 self.browser.open(URL_LECTURER_LANDING) 4028 # no course appears 4029 self.assertFalse( 4030 "<span>Unnamed Course (COURSE1)</span>" 4031 in self.browser.contents) 4032 # we assign lecturer at department level 4033 dep = self.app['faculties']['fac1']['dep1'] 4034 prmlocal = IPrincipalRoleManager(dep) 4035 prmlocal.assignRoleToPrincipal('waeup.local.Lecturer', 'mrslecturer') 4036 notify(LocalRoleSetEvent( 4037 dep, 'waeup.local.Lecturer', 'mrslecturer', granted=True)) 4038 self.browser.open(URL_LECTURER_LANDING) 4039 # course appears again 4040 self.assertTrue( 4041 "<span>Unnamed Course (COURSE1)</span>" 4042 in self.browser.contents) 4013 4043 4014 4044 def test_my_roles_link_works(self): -
main/waeup.kofa/trunk/src/waeup/kofa/university/department.py
r14511 r14992 58 58 'waeup.local.CourseAdviser800', 59 59 'waeup.local.LocalStudentsManager', 60 'waeup.local.Lecturer', 60 61 ] 61 62
Note: See TracChangeset for help on using the changeset viewer.