Ignore:
Timestamp:
13 Apr 2011, 08:53:45 (14 years ago)
Author:
uli
Message:

Handle applicant permissions for applicant forms, including first test.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
1 added
2 edited

Legend:

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

    r5928 r5937  
    2929from zope.component import getUtility, getAllUtilitiesRegisteredFor
    3030from zope.formlib.widgets import FileWidget, DateWidget
     31from zope.securitypolicy.interfaces import IPrincipalRoleManager
    3132from waeup.sirp.browser import (
    3233    WAeUPPage, WAeUPEditFormPage, WAeUPAddFormPage,
     
    313314            applicant.access_code = pin
    314315            self.context[pin] = applicant
    315             # XXX: set owner role on created applicant
    316 
    317         self.redirect(self.url(self.context[pin]))
     316           
     317        # Assign current principal the owner role on created applicant
     318        # record
     319        role_manager = IPrincipalRoleManager(self.context)
     320        role_manager.assignRoleToPrincipal(
     321            'waeup.ApplicationOwner', self.request.principal.id)
     322        self.redirect(self.url(self.context[pin], 'edit'))
    318323        return
    319324
     
    345350    grok.context(IApplicant)
    346351    grok.name('index')
     352    grok.require('waeup.viewApplication')
    347353    form_fields = grok.AutoFields(IApplicant)
    348354    form_fields['fst_sit_results'].custom_widget = list_results_display_widget
     
    357363    grok.context(IApplicant)
    358364    grok.name('edit')
     365    grok.require('waeup.editApplication')
    359366    form_fields = grok.AutoFields(IApplicantPDEEditData)
    360367    #form_fields['passport'].custom_widget = FileWidget
  • main/waeup.sirp/trunk/src/waeup/sirp/permissions.py

    r5433 r5937  
    3030class FacultyRead(grok.Permission):
    3131    grok.name('waeup.facultyread')
    32    
     32
     33# Application permissions
     34class ViewApplication(grok.Permission):
     35    grok.name('waeup.viewApplication')
     36
     37class ViewFullApplication(grok.Permission):
     38    grok.name('waeup.viewFullApplication')
     39
     40class EditApplication(grok.Permission):
     41    grok.name('waeup.editApplication')
     42
     43class EditFullApplication(grok.Permission):
     44    grok.name('waeup.editFullApplication')
     45
     46# Roles
    3347class PortalUser(grok.Role):
    3448    grok.name('waeup.PortalUser')
     
    4054                     'waeup.View', 'waeup.Public','waeup.manageACBatches')
    4155
     56class ApplicationOwner(grok.Role):
     57    grok.name('waeup.ApplicationOwner')
     58    grok.permissions('waeup.viewApplication', 'waeup.editApplication')
     59   
    4260def getRoles():
    4361    app = grok.getSite()
Note: See TracChangeset for help on using the changeset viewer.