Ignore:
Timestamp:
27 Jun 2024, 09:55:33 (6 months ago)
Author:
Henrik Bettermann
Message:

Add permission and role for NYSC Officers.

Location:
main/waeup.uniben/trunk/src/waeup/uniben
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/permissions.py

    r15371 r17824  
    2525    grok.name('waeup.switchLibraryAccess')
    2626
     27class ExportNYSCData(grok.Permission):
     28    """NYSC Officers don't have the general exportData
     29    permission and are only allowed to export NYSC data.
     30    The ExportNYSCData permission is only used to filter the
     31    respective exporter in the ExportJobContainerJobConfig view.
     32    """
     33    grok.name('waeup.exportNYSCData')
     34
    2735class PassportPictureManager(grok.Role):
    2836    grok.name('waeup.PassportPictureManager')
     
    3947                     'waeup.switchLibraryAccess')
    4048
     49class NYSCOfficer(grok.Role):
     50    """NYSC Officers can export NYSC and  data. They can't
     51    access the Data Center but see student data export buttons in the
     52    Academic Section.
     53    """
     54    grok.name('waeup.NYSCOfficer')
     55    grok.title(u'NYSC Officer')
     56    grok.permissions('waeup.showStudents',
     57                     'waeup.viewAcademics',
     58                     'waeup.exportNYSCData',)
     59
    4160class CRPUOfficer(CCOfficer):
    4261    """ Permissions of Uniben CRPU members.
  • main/waeup.uniben/trunk/src/waeup/uniben/utils/utils.py

    r17578 r17824  
    1919"""
    2020from copy import deepcopy
     21from zope.security import checkPermission
    2122from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
    2223
     
    228229            title = "NA / %s (%s)" % (value.title, value.code)
    229230        return title
     231
     232    def collect_exporters(self, context):
     233        # Used for `ExportJobContainerJobConfig`.
     234        # We provide all student exporters, nothing else, yet.
     235        # Bursary, Department or Accommodation Officers don't
     236        # have the general exportData
     237        # permission and are only allowed to export bursary, payments
     238        # overview or accommodation data respectively.
     239        # This is the only place where waeup.exportAccommodationData,
     240        # waeup.exportBursaryData and waeup.exportPaymentsOverview
     241        # are used.
     242        # Uniben: Add NYSC Officers.
     243        exporters = []
     244        if not checkPermission('waeup.exportData', context):
     245            if checkPermission('waeup.exportBursaryData', context):
     246                exporters += [('Bursary Data', 'bursary')]
     247            if checkPermission('waeup.exportPaymentsOverview', context):
     248                exporters += [('School Fee Payments Overview',
     249                               'sfpaymentsoverview'),
     250                              ('Session Payments Overview',
     251                               'sessionpaymentsoverview')]
     252            if checkPermission('waeup.exportAccommodationData', context):
     253                exporters += [('Bed Tickets', 'bedtickets'),
     254                              ('Accommodation Payments',
     255                               'accommodationpayments')]
     256            if checkPermission('waeup.exportNYSCData', context):
     257                exporters += [('NYSC Data', 'NYSC'),]
     258            return exporters
     259
Note: See TracChangeset for help on using the changeset viewer.