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

Make _set_exporter_values customizable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r17798 r17823  
    2626from random import SystemRandom as r
    2727from zope.i18n import translate
     28from zope.security import checkPermission
    2829from waeup.kofa.interfaces import IKofaUtils
    2930from waeup.kofa.interfaces import MessageFactory as _
     
    567568        value = int(pow(10, prec)*value) / (1.0*pow(10, prec))
    568569        return '{:{width}.{prec}f}'.format(value, width=0, prec=prec)
     570
     571    def collect_exporters(self, context):
     572        # Used for `ExportJobContainerJobConfig`.
     573        # We provide all student exporters, nothing else, yet.
     574        # Bursary, Department or Accommodation Officers don't
     575        # have the general exportData
     576        # permission and are only allowed to export bursary, payments
     577        # overview or accommodation data respectively.
     578        # This is the only place where waeup.exportAccommodationData,
     579        # waeup.exportBursaryData and waeup.exportPaymentsOverview
     580        # are used.
     581        exporters = []
     582        if not checkPermission('waeup.exportData', context):
     583            if checkPermission('waeup.exportBursaryData', context):
     584                exporters += [('Bursary Data', 'bursary')]
     585            if checkPermission('waeup.exportPaymentsOverview', context):
     586                exporters += [('School Fee Payments Overview',
     587                               'sfpaymentsoverview'),
     588                              ('Session Payments Overview',
     589                               'sessionpaymentsoverview')]
     590            if checkPermission('waeup.exportAccommodationData', context):
     591                exporters += [('Bed Tickets', 'bedtickets'),
     592                              ('Accommodation Payments',
     593                               'accommodationpayments')]
     594            return exporters
Note: See TracChangeset for help on using the changeset viewer.