Changeset 7184
- Timestamp:
- 24 Nov 2011, 09:20:13 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r7166 r7184 234 234 return self.context.access_code 235 235 236 class Applicants Tab(PrimaryNavTab):236 class ApplicantsAuthTab(PrimaryNavTab): 237 237 """Applicants tab in primary navigation. 238 238 """ 239 240 239 grok.context(IWAeUPObject) 241 240 grok.order(3) 242 grok.require('waeup. Public')241 grok.require('waeup.viewApplication') 243 242 grok.template('primarynavtab') 244 245 243 pnav = 3 246 244 tab_title = u'Applicants' … … 249 247 def link_target(self): 250 248 return self.view.application_url('applicants') 249 250 class ApplicantsAnonTab(ApplicantsAuthTab): 251 """Applicants tab in primary navigation. 252 253 Display tab only for anonymous. Authenticated users can call the 254 form from the user navigation bar. 255 """ 256 grok.require('waeup.Anonymous') 257 tab_title = u'Application' 258 259 # Also zope.manager has role Anonymous. 260 # To avoid displaying this tab, uncomment the following. 261 #def tab_title(self): 262 # userid = self.request.principal.id 263 # if userid != 'zope.anybody': 264 # tt = u'' 265 # else: 266 # tt = u'Application' 267 # return tt 251 268 252 269 class ApplicantsContainerPage(WAeUPDisplayFormPage): -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/permissions.py
r7178 r7184 46 46 class ApplicantRole(grok.Role): 47 47 grok.name('waeup.Applicant') 48 grok.permissions('waeup. Public', 'waeup.View')48 grok.permissions('waeup.viewAcademics') 49 49 50 50 class ApplicationsOfficer(grok.Role): -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py
r7137 r7184 138 138 'Manage' in self.browser.contents) 139 139 140 140 141 def test_anonymous_no_actions(self): 141 142 # Make sure anonymous users cannot access actions … … 173 174 return 174 175 175 def test_local_roles_add_delete(self): 176 # Managers can assign and delete local roles of applicants root 177 myusers = self.app['users'] 178 myusers.addUser('bob', 'bobssecret') 179 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 180 self.browser.open(self.manage_root_path) 181 self.browser.getControl(name="user").value = ['bob'] 182 self.browser.getControl(name="local_role").value = [ 183 'waeup.ApplicationsOfficer'] 184 self.browser.getControl("Add local role").click() 185 self.assertTrue('<td>bob</td>' in self.browser.contents) 186 # Remove the role assigned 187 ctrl = self.browser.getControl(name='role_id') 188 ctrl.getControl(value='bob|waeup.ApplicationsOfficer').selected = True 189 self.browser.getControl("Remove selected local roles").click() 190 self.assertTrue('Successfully removed:' in self.browser.contents) 191 self.assertFalse('<td>bob</td>' in self.browser.contents) 192 return 176 # We have no local roles yet 177 #def test_local_roles_add_delete(self): 178 # # Managers can assign and delete local roles of applicants root 179 # myusers = self.app['users'] 180 # myusers.addUser('bob', 'bobssecret') 181 # self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 182 # self.browser.open(self.manage_root_path) 183 # self.browser.getControl(name="user").value = ['bob'] 184 # self.browser.getControl(name="local_role").value = [ 185 # 'waeup.local.ApplicationsOfficer'] 186 # self.browser.getControl("Add local role").click() 187 # self.assertTrue('<td>bob</td>' in self.browser.contents) 188 # # Remove the role assigned 189 # ctrl = self.browser.getControl(name='role_id') 190 # ctrl.getControl(value='bob|waeup.ApplicationsOfficer').selected = True 191 # self.browser.getControl("Remove selected local roles").click() 192 # self.assertTrue('Successfully removed:' in self.browser.contents) 193 # self.assertFalse('<td>bob</td>' in self.browser.contents) 194 # return 193 195 194 196 def test_add_delete_container(self): … … 423 425 return 424 426 425 def test_local_roles_add_delete(self): 426 # Managers can assign and delete local roles of applicants containers 427 myusers = self.app['users'] 428 myusers.addUser('bob', 'bobssecret') 429 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 430 self.browser.open(self.manage_container_path) 431 self.browser.getControl(name="user").value = ['bob'] 432 self.browser.getControl(name="local_role").value = [ 433 'waeup.ApplicationsOfficer'] 434 self.browser.getControl("Add local role").click() 435 self.assertTrue('<td>bob</td>' in self.browser.contents) 436 ctrl = self.browser.getControl(name='role_id') 437 ctrl.getControl(value='bob|waeup.ApplicationsOfficer').selected = True 438 self.browser.getControl("Remove selected local roles").click() 439 self.assertTrue('Successfully removed:' in self.browser.contents) 440 self.assertFalse('<td>bob</td>' in self.browser.contents) 441 return 427 # We have no local roles yet 428 #def test_local_roles_add_delete(self): 429 # # Managers can assign and delete local roles of applicants containers 430 # myusers = self.app['users'] 431 # myusers.addUser('bob', 'bobssecret') 432 # self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 433 # self.browser.open(self.manage_container_path) 434 # self.browser.getControl(name="user").value = ['bob'] 435 # self.browser.getControl(name="local_role").value = [ 436 # 'waeup.local.ApplicationsOfficer'] 437 # self.browser.getControl("Add local role").click() 438 # self.assertTrue('<td>bob</td>' in self.browser.contents) 439 # ctrl = self.browser.getControl(name='role_id') 440 # ctrl.getControl(value='bob|waeup.ApplicationsOfficer').selected = True 441 # self.browser.getControl("Remove selected local roles").click() 442 # self.assertTrue('Successfully removed:' in self.browser.contents) 443 # self.assertFalse('<td>bob</td>' in self.browser.contents) 444 # return 442 445 443 446 class LoginTest(FunctionalTestCase): -
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r7179 r7184 1128 1128 """ 1129 1129 grok.context(IFacultyContainer) 1130 grok.require('waeup. View')1130 grok.require('waeup.viewAcademics') 1131 1131 grok.name('index') 1132 1132 title = 'Academics' … … 1206 1206 """ 1207 1207 grok.context(IFaculty) 1208 grok.require('waeup. View')1208 grok.require('waeup.viewAcademics') 1209 1209 grok.name('index') 1210 1210 pnav = 1 … … 1327 1327 """ 1328 1328 grok.context(IDepartment) 1329 grok.require('waeup. View')1329 grok.require('waeup.viewAcademics') 1330 1330 grok.name('index') 1331 1331 pnav = 1 … … 1547 1547 grok.context(ICourse) 1548 1548 grok.name('index') 1549 grok.require('waeup. View')1549 grok.require('waeup.viewAcademics') 1550 1550 pnav = 1 1551 1551 #form_fields = grok.AutoFields(ICourse) … … 1594 1594 grok.context(ICertificate) 1595 1595 grok.name('index') 1596 grok.require('waeup. View')1596 grok.require('waeup.viewAcademics') 1597 1597 pnav = 1 1598 1598 form_fields = grok.AutoFields(ICertificate) … … 1702 1702 grok.context(ICertificateCourse) 1703 1703 grok.name('index') 1704 grok.require('waeup. View')1704 grok.require('waeup.viewAcademics') 1705 1705 pnav = 1 1706 1706 #form_fields = grok.AutoFields(ICertificateCourse) -
main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/studentsitelayout.pt
r7129 r7184 29 29 </span> </h1> 30 30 <div id="navigation" class="yui-navset" style="text-align:right;"> 31 <ul id="primary-navigation" tal:condition="layout/isAuthenticated"> 31 <ul id="primary-navigation"> 32 <tal:primary_nav content="structure provider:primary_nav" /> 32 33 <tal:primary_nav content="structure provider:primary_nav_student" /> 33 </ul>34 <ul id="primary-navigation" tal:condition="not: layout/isAuthenticated">35 <tal:primary_nav content="structure provider:primary_nav" />36 34 </ul> 37 35 <ul id="user-navigation"> -
main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py
r7179 r7184 551 551 grok.viewletmanager(PrimaryNavManager) 552 552 grok.order(1) 553 grok.require('waeup. View')553 grok.require('waeup.Public') 554 554 555 555 pnav = 0 # This is a kind of id of a tab. If some page provides … … 590 590 """ 591 591 grok.order(2) 592 grok.require('waeup. View')592 grok.require('waeup.viewAcademics') 593 593 grok.template('primarynavtab') 594 594 … … 603 603 class ContactTab(PrimaryNavTab): 604 604 """Contact tab in primary navigation. 605 606 Display tab only for anonymous. Authenticated users can call the 607 form from the user navigation bar. 605 608 """ 606 609 grok.order(6) 607 610 grok.require('waeup.Anonymous') 608 611 grok.template('primarynavtab') 609 612 tab_title = u'Enquiries' 610 613 pnav = 2 611 def tab_title(self): 612 """Display tab only for anonymous. Authenticated users can call the613 form from the user navigation bar.614 """615 userid = self.request.principal.id616 if userid != 'zope.anybody':617 tt = u''618 else:619 tt = u'Enquiries'620 return tt621 622 @property623 def active(self):624 view_pnav = getattr(self.view, 'pnav', 0)625 userid = self.request.principal.id626 if view_pnav == self.pnav and userid == 'zope.anybody':627 return 'active'628 return ''614 615 # Also zope.manager has role Anonymous. 616 # To avoid displaying this tab, uncomment the following. 617 #def tab_title(self): 618 # userid = self.request.principal.id 619 # if userid != 'zope.anybody': 620 # tt = u'' 621 # else: 622 # tt = u'Enquiries' 623 # return tt 624 625 #@property 626 #def active(self): 627 # view_pnav = getattr(self.view, 'pnav', 0) 628 # userid = self.request.principal.id 629 # if view_pnav == self.pnav and userid == 'zope.anybody': 630 # return 'active' 631 # return '' 629 632 630 633 @property … … 717 720 grok.viewletmanager(SubobjectLister) 718 721 grok.context(IFacultyContainer) 719 grok.require('waeup. View')722 grok.require('waeup.viewAcademics') 720 723 721 724 def render(self): … … 728 731 grok.viewletmanager(SubobjectLister) 729 732 grok.context(IFaculty) 730 grok.require('waeup. View')733 grok.require('waeup.viewAcademics') 731 734 732 735 def render(self): … … 740 743 grok.viewletmanager(SubobjectLister) 741 744 grok.context(IFaculty) 742 grok.require('waeup. View')745 grok.require('waeup.viewAcademics') 743 746 744 747 def render(self): -
main/waeup.sirp/trunk/src/waeup/sirp/permissions.py
r7181 r7184 23 23 grok.name('waeup.Anonymous') 24 24 25 class ViewPermission(grok.Permission): 26 grok.name('waeup.View') 25 class Authenticated(grok.Permission): 26 """Only-logged-in-users-can-do-this-permission. 27 """ 28 grok.name('waeup.Authenticated') 29 30 class ViewAcademicsPermission(grok.Permission): 31 grok.name('waeup.viewAcademics') 27 32 28 33 class ManageUniversity(grok.Permission): … … 50 55 grok.permissions('waeup.manageUniversity') 51 56 52 53 57 class ClearanceOfficer(grok.Role): 54 58 """The clearance officer role is meant for the … … 74 78 grok.name('waeup.PortalUser') 75 79 grok.title(u'Portal User') 76 grok.permissions('waeup. View', 'waeup.Public')80 grok.permissions('waeup.viewAcademics') 77 81 78 82 class ACManager(grok.Role): … … 85 89 grok.title(u'Portal Manager') 86 90 grok.permissions('waeup.manageUniversity', 'waeup.manageUsers', 87 'waeup. View', 'waeup.Public','waeup.manageACBatches',91 'waeup.viewAcademics', 'waeup.manageACBatches', 88 92 'waeup.manageDataCenter','waeup.managePortalSettings', 89 'waeup.managePortalConfiguration', 90 'waeup.manageApplication s', 'waeup.handleApplication',93 'waeup.managePortalConfiguration', 'waeup.viewApplication', 94 'waeup.manageApplication', 'waeup.handleApplication', 91 95 'waeup.viewStudent', 'waeup.manageStudent', 'clearStudent', 92 'waeup.uploadStudentFile', 96 'waeup.uploadStudentFile', 'waeup.viewStudents', 93 97 'waeup.viewHostels', 'waeup.manageHostels') 94 98 -
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r7181 r7184 33 33 from waeup.sirp.browser.resources import datepicker, datatable, tabs 34 34 from waeup.sirp.browser.viewlets import ( 35 ManageActionButton, PrimaryNavTab,AddActionButton)35 ManageActionButton, AddActionButton) 36 36 from waeup.sirp.interfaces import ( 37 37 IWAeUPObject, IUserAccount, IExtFileStore, IPasswordValidator) … … 80 80 return 81 81 82 class StudentsTab(PrimaryNavTab):83 """Students tab in primary navigation.84 """85 86 grok.context(IWAeUPObject)87 grok.order(4)88 grok.require('waeup.viewStudent')89 grok.template('primarynavtab')90 91 pnav = 492 tab_title = u'Students'93 94 @property95 def link_target(self):96 return self.view.application_url('students')97 98 82 class StudentsBreadcrumb(Breadcrumb): 99 83 """A breadcrumb for the students container. … … 170 154 grok.context(IStudentsContainer) 171 155 grok.name('index') 172 grok.require('waeup.viewStudent ')156 grok.require('waeup.viewStudents') 173 157 grok.template('containerpage') 174 158 label = 'Student Section' -
main/waeup.sirp/trunk/src/waeup/sirp/students/permissions.py
r7181 r7184 27 27 grok.name('waeup.viewStudent') 28 28 29 class ViewStudents(grok.Permission): 30 grok.name('waeup.viewStudents') 31 29 32 class PayStudent(grok.Permission): 30 33 grok.name('waeup.payStudent') … … 48 51 grok.permissions('waeup.handleStudent', 'waeup.uploadStudentFile', 49 52 'waeup.viewStudent', 'waeup.payStudent', 50 'waeup.handleAccommodation' )53 'waeup.handleAccommodation', 'waeup.Authenticated') 51 54 52 55 # Site Roles 53 56 class StudentRole(grok.Role): 54 57 grok.name('waeup.Student') 55 grok.permissions('waeup. Public', 'waeup.View')58 grok.permissions('waeup.viewAcademics') 56 59 57 60 class StudentsOfficer(grok.Role): 58 61 grok.name('waeup.StudentsOfficer') 59 62 grok.title(u'Students Officer (view only)') 60 grok.permissions('waeup.viewStudent', )63 grok.permissions('waeup.viewStudent','waeup.viewStudents') 61 64 62 65 class StudentsManager(grok.Role): … … 65 68 grok.permissions('waeup.viewStudent', 'waeup.manageStudent', 66 69 'waeup.payStudent', 'waeup.uploadStudentFile', 67 'waeup.handleAccommodation' )70 'waeup.handleAccommodation', 'waeup.viewStudents') 68 71 69 72 class StudentsClearanceOfficer(grok.Role): -
main/waeup.sirp/trunk/src/waeup/sirp/students/viewlets.py
r7181 r7184 7 7 from waeup.sirp.utils.helpers import string_from_bytes, file_size 8 8 from waeup.sirp.browser import DEFAULT_IMAGE_PATH 9 from waeup.sirp.browser.viewlets import PrimaryNavTab 9 10 from waeup.sirp.students.browser import ( 10 11 StudentClearanceDisplayFormPage, StudentClearanceManageFormPage, … … 139 140 text = u'History' 140 141 142 class StudentsTab(PrimaryNavTab): 143 """Students tab in primary navigation. 144 """ 145 146 grok.context(IWAeUPObject) 147 grok.order(4) 148 grok.require('waeup.viewStudents') 149 grok.template('primarynavtab') 150 151 pnav = 4 152 tab_title = u'Students' 153 154 @property 155 def link_target(self): 156 return self.view.application_url('students') 157 141 158 class PrimaryStudentNavManager(grok.ViewletManager): 142 159 """Viewlet manager for the primary navigation tab. … … 151 168 grok.template('primarynavtab') 152 169 grok.order(1) 153 grok.require('waeup. View')170 grok.require('waeup.Authenticated') 154 171 pnav = 0 155 172 tab_title = u'Some Text' … … 166 183 return '' 167 184 168 class HomeTab(PrimaryStudentNavTab):169 """Home-tab in primary navigation.170 """171 grok.order(1)172 grok.require('waeup.Public')173 pnav = 0174 tab_title = u'Home'175 176 class ProspectusTab(PrimaryStudentNavTab):177 """Faculties-tab in primary navigation.178 """179 grok.order(2)180 grok.require('waeup.View')181 pnav = 1182 tab_title = u'Prospectus'183 184 @property185 def link_target(self):186 return self.view.application_url('faculties')185 #class HomeTab(PrimaryStudentNavTab): 186 # """Home-tab in primary navigation. 187 # """ 188 # grok.order(1) 189 # grok.require('waeup.Authenticated') 190 # pnav = 0 191 # tab_title = u'Home' 192 193 #class ProspectusTab(PrimaryStudentNavTab): 194 # """Faculties-tab in primary navigation. 195 # """ 196 # grok.order(2) 197 # grok.require('waeup.viewAcademics') 198 # pnav = 1 199 # tab_title = u'Prospectus' 200 201 # @property 202 # def link_target(self): 203 # return self.view.application_url('faculties') 187 204 188 205 class MyDataTab(PrimaryStudentNavTab): … … 190 207 """ 191 208 grok.order(3) 192 grok.require('waeup. Public')209 grok.require('waeup.Authenticated') 193 210 pnav = 4 194 211 tab_title = u'My Data'
Note: See TracChangeset for help on using the changeset viewer.