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/browser
Files:
3 edited

Legend:

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

    r7179 r7184  
    11281128    """
    11291129    grok.context(IFacultyContainer)
    1130     grok.require('waeup.View')
     1130    grok.require('waeup.viewAcademics')
    11311131    grok.name('index')
    11321132    title = 'Academics'
     
    12061206    """
    12071207    grok.context(IFaculty)
    1208     grok.require('waeup.View')
     1208    grok.require('waeup.viewAcademics')
    12091209    grok.name('index')
    12101210    pnav = 1
     
    13271327    """
    13281328    grok.context(IDepartment)
    1329     grok.require('waeup.View')
     1329    grok.require('waeup.viewAcademics')
    13301330    grok.name('index')
    13311331    pnav = 1
     
    15471547    grok.context(ICourse)
    15481548    grok.name('index')
    1549     grok.require('waeup.View')
     1549    grok.require('waeup.viewAcademics')
    15501550    pnav = 1
    15511551    #form_fields = grok.AutoFields(ICourse)
     
    15941594    grok.context(ICertificate)
    15951595    grok.name('index')
    1596     grok.require('waeup.View')
     1596    grok.require('waeup.viewAcademics')
    15971597    pnav = 1
    15981598    form_fields = grok.AutoFields(ICertificate)
     
    17021702    grok.context(ICertificateCourse)
    17031703    grok.name('index')
    1704     grok.require('waeup.View')
     1704    grok.require('waeup.viewAcademics')
    17051705    pnav = 1
    17061706    #form_fields = grok.AutoFields(ICertificateCourse)
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/studentsitelayout.pt

    r7129 r7184  
    2929            </span> </h1>
    3030          <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" />
    3233              <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" />
    3634            </ul>
    3735            <ul id="user-navigation">
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py

    r7179 r7184  
    551551    grok.viewletmanager(PrimaryNavManager)
    552552    grok.order(1)
    553     grok.require('waeup.View')
     553    grok.require('waeup.Public')
    554554
    555555    pnav = 0 # This is a kind of id of a tab. If some page provides
     
    590590    """
    591591    grok.order(2)
    592     grok.require('waeup.View')
     592    grok.require('waeup.viewAcademics')
    593593    grok.template('primarynavtab')
    594594
     
    603603class ContactTab(PrimaryNavTab):
    604604    """Contact tab in primary navigation.
     605
     606    Display tab only for anonymous. Authenticated users can call the
     607    form from the user navigation bar.
    605608    """
    606609    grok.order(6)
    607610    grok.require('waeup.Anonymous')
    608611    grok.template('primarynavtab')
    609    
     612    tab_title = u'Enquiries'
    610613    pnav = 2
    611     def tab_title(self):
    612         """Display tab only for anonymous. Authenticated users can call the
    613         form from the user navigation bar.
    614         """
    615         userid = self.request.principal.id
    616         if userid != 'zope.anybody':
    617             tt = u''
    618         else:
    619             tt = u'Enquiries'         
    620         return tt
    621 
    622     @property
    623     def active(self):
    624         view_pnav = getattr(self.view, 'pnav', 0)
    625         userid = self.request.principal.id
    626         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 ''
    629632
    630633    @property
     
    717720    grok.viewletmanager(SubobjectLister)
    718721    grok.context(IFacultyContainer)
    719     grok.require('waeup.View')
     722    grok.require('waeup.viewAcademics')
    720723
    721724    def render(self):
     
    728731    grok.viewletmanager(SubobjectLister)
    729732    grok.context(IFaculty)
    730     grok.require('waeup.View')
     733    grok.require('waeup.viewAcademics')
    731734
    732735    def render(self):
     
    740743    grok.viewletmanager(SubobjectLister)
    741744    grok.context(IFaculty)
    742     grok.require('waeup.View')
     745    grok.require('waeup.viewAcademics')
    743746
    744747    def render(self):
Note: See TracChangeset for help on using the changeset viewer.