Changeset 9002
- Timestamp:
- 13 Jul 2012, 16:36:21 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/permissions.py
r8962 r9002 152 152 grok.permissions('waeup.showStudents', 'waeup.viewAcademics') 153 153 154 class Lecturer(grok.Role): 155 """The lecturer role is meant for the 156 assignment of dynamic roles only. 157 """ 158 grok.name('waeup.local.Lecturer') 159 grok.title(u'Lecturer') 160 grok.permissions('waeup.showStudents', 'waeup.viewAcademics') 161 154 162 class Owner(grok.Role): 155 163 grok.name('waeup.local.Owner') -
main/waeup.kofa/trunk/src/waeup/kofa/permissions.txt
r8962 r9002 42 42 43 43 >>> len(list(get_waeup_roles(also_local=True))) 44 2 844 29 45 45 46 46 -
main/waeup.kofa/trunk/src/waeup/kofa/students/dynamicroles.py
r8963 r9002 46 46 rolename_mapping = { 47 47 'waeup.local.ClearanceOfficer':'waeup.StudentsClearanceOfficer', 48 'waeup.local.UGClearanceOfficer':'waeup.StudentsClearanceOfficer',49 'waeup.local.PGClearanceOfficer':'waeup.StudentsClearanceOfficer',50 48 } 51 49 -
main/waeup.kofa/trunk/src/waeup/kofa/university/course.py
r8996 r9002 30 30 grok.implements(ICourse, ICourseAdd) 31 31 32 local_roles = [ ]32 local_roles = ['waeup.local.Lecturer'] 33 33 34 34 def __init__(self, -
main/waeup.kofa/trunk/src/waeup/kofa/university/tests/test_batching.py
r9001 r9002 64 64 65 65 CERTIFICATE_HEADER_FIELDS = CERTIFICATE_SAMPLE_DATA.split( 66 '\n')[0].split(',') 67 68 COURSE_SAMPLE_DATA = open( 69 os.path.join(os.path.dirname(__file__), 'sample_course_data.csv'), 70 'rb').read() 71 72 COURSE_HEADER_FIELDS = COURSE_SAMPLE_DATA.split( 66 73 '\n')[0].split(',') 67 74 … … 375 382 self.row3 = dict(department_code='DEP1', faculty_code='FAC1', code="CRS2") 376 383 self.row4 = dict(department_code='DEP1', faculty_code='FAC1', code="CRS1") 384 385 self.csv_file_course = os.path.join(self.workdir, 'sample_course_data.csv') 386 open(self.csv_file_course, 'wb').write(COURSE_SAMPLE_DATA) 377 387 return 378 388 … … 419 429 self.assertTrue('CRS1' not in self.app['faculties']['FAC1']['DEP1'].courses.keys()) 420 430 return 431 432 def test_import(self): 433 num, num_warns, fin_file, fail_file = self.proc.doImport( 434 self.csv_file_course, COURSE_HEADER_FIELDS) 435 content = open(fail_file).read() 436 self.assertEqual(num_warns,6) 437 self.assertEqual( 438 content, 439 'faculty_code,department_code,code,local_roles,--ERRORS--\r\n' 440 'FAC1,DEP1,CRS2,"[{\'user_name\':\'alice\',\'local_role\':\'waeup.local.Lecturer\'}]",' 441 'local_roles: alice does not exist\r\n' 442 'FAC1,DEP1,CRS2,"[{\'user_name\':\'anne\',\'local_role\':\'waeup.local.Boss\'}]",' 443 'local_roles: waeup.local.Boss not allowed\r\n' 444 'FAC1,DEP1,CRS2,[(\'anything\')],local_roles: no dicts\r\n' 445 'FAC1,DEP1,CRS2,[,local_roles: Error\r\n' 446 'FAC1,DEP1,CRS2,"[{\'user\':\'anne\',\'local\':\'waeup.local.Lecturer\'}]",' 447 'local_roles: user_name or local_role missing\r\n' 448 'FAC11,DEP2,CRS2,"[{\'user_name\':\'anne\',\'local_role\':\'waeup.local.Lecturer\'}]",' 449 'Not all parents do exist yet. Skipping\r\n' 450 ) 451 # Anne got a local role in course ABC. 452 dep = self.app['faculties']['FAC1']['DEP1'].courses['CRS2'] 453 role_map = IPrincipalRoleMap(dep) 454 local_role, user_name, setting = role_map.getPrincipalsAndRoles()[0] 455 self.assertEqual(user_name, 'anne') 456 self.assertEqual(local_role, 'waeup.local.Lecturer') 457 shutil.rmtree(os.path.dirname(fin_file)) 458 return 459 421 460 422 461 class CertificateProcessorTests(UniversityProcessorSetup):
Note: See TracChangeset for help on using the changeset viewer.