Ignore:
Timestamp:
24 Nov 2011, 09:20:13 (13 years ago)
Author:
Henrik Bettermann
Message:

Reorganise permissions:

The navigation viewlets now manage the permission requirements themselves. No need to do this in pagetemplates.

Rename permission waeup.View to waeup.viewAcademics because it only refers to the academic section.

Add permission waeup.Authenticated (which is used in students). The StudentRecordOwner? explicitly needs this permission. Otherwise the MyData? tab disappears when changing the password.

Roles do not need to get the waeup.Public permission. This is already guaranteed in site.zcml.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r7181 r7184  
    3333from waeup.sirp.browser.resources import datepicker, datatable, tabs
    3434from waeup.sirp.browser.viewlets import (
    35     ManageActionButton, PrimaryNavTab, AddActionButton)
     35    ManageActionButton, AddActionButton)
    3636from waeup.sirp.interfaces import (
    3737    IWAeUPObject, IUserAccount, IExtFileStore, IPasswordValidator)
     
    8080    return
    8181
    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 = 4
    92     tab_title = u'Students'
    93 
    94     @property
    95     def link_target(self):
    96         return self.view.application_url('students')
    97 
    9882class StudentsBreadcrumb(Breadcrumb):
    9983    """A breadcrumb for the students container.
     
    170154    grok.context(IStudentsContainer)
    171155    grok.name('index')
    172     grok.require('waeup.viewStudent')
     156    grok.require('waeup.viewStudents')
    173157    grok.template('containerpage')
    174158    label = 'Student Section'
  • main/waeup.sirp/trunk/src/waeup/sirp/students/permissions.py

    r7181 r7184  
    2727    grok.name('waeup.viewStudent')
    2828
     29class ViewStudents(grok.Permission):
     30    grok.name('waeup.viewStudents')
     31
    2932class PayStudent(grok.Permission):
    3033    grok.name('waeup.payStudent')
     
    4851    grok.permissions('waeup.handleStudent', 'waeup.uploadStudentFile',
    4952                     'waeup.viewStudent', 'waeup.payStudent',
    50                      'waeup.handleAccommodation')
     53                     'waeup.handleAccommodation', 'waeup.Authenticated')
    5154
    5255# Site Roles
    5356class StudentRole(grok.Role):
    5457    grok.name('waeup.Student')
    55     grok.permissions('waeup.Public', 'waeup.View')
     58    grok.permissions('waeup.viewAcademics')
    5659
    5760class StudentsOfficer(grok.Role):
    5861    grok.name('waeup.StudentsOfficer')
    5962    grok.title(u'Students Officer (view only)')
    60     grok.permissions('waeup.viewStudent',)
     63    grok.permissions('waeup.viewStudent','waeup.viewStudents')
    6164
    6265class StudentsManager(grok.Role):
     
    6568    grok.permissions('waeup.viewStudent', 'waeup.manageStudent',
    6669                     'waeup.payStudent', 'waeup.uploadStudentFile',
    67                      'waeup.handleAccommodation')
     70                     'waeup.handleAccommodation', 'waeup.viewStudents')
    6871
    6972class StudentsClearanceOfficer(grok.Role):
  • main/waeup.sirp/trunk/src/waeup/sirp/students/viewlets.py

    r7181 r7184  
    77from waeup.sirp.utils.helpers import string_from_bytes, file_size
    88from waeup.sirp.browser import DEFAULT_IMAGE_PATH
     9from waeup.sirp.browser.viewlets import PrimaryNavTab
    910from waeup.sirp.students.browser import (
    1011    StudentClearanceDisplayFormPage, StudentClearanceManageFormPage,
     
    139140    text = u'History'
    140141
     142class 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
    141158class PrimaryStudentNavManager(grok.ViewletManager):
    142159    """Viewlet manager for the primary navigation tab.
     
    151168    grok.template('primarynavtab')
    152169    grok.order(1)
    153     grok.require('waeup.View')
     170    grok.require('waeup.Authenticated')
    154171    pnav = 0
    155172    tab_title = u'Some Text'
     
    166183        return ''
    167184
    168 class HomeTab(PrimaryStudentNavTab):
    169     """Home-tab in primary navigation.
    170     """
    171     grok.order(1)
    172     grok.require('waeup.Public')
    173     pnav = 0
    174     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 = 1
    182     tab_title = u'Prospectus'
    183 
    184     @property
    185     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')
    187204
    188205class MyDataTab(PrimaryStudentNavTab):
     
    190207    """
    191208    grok.order(3)
    192     grok.require('waeup.Public')
     209    grok.require('waeup.Authenticated')
    193210    pnav = 4
    194211    tab_title = u'My Data'
Note: See TracChangeset for help on using the changeset viewer.