Allow organizer-level exports with separate permission and no event selection

This commit is contained in:
Raphael Michel
2022-10-05 09:56:43 +02:00
parent 74e14285ee
commit 60cdfe4029
7 changed files with 96 additions and 21 deletions

View File

@@ -51,7 +51,7 @@ from pretix.helpers.safe_openpyxl import ( # NOQA: backwards compatibility for
SafeWorkbook, remove_invalid_excel_chars as excel_safe,
)
__ = excel_safe # just so the compatbility import above is "used" and doesn't get removed by linter
__ = excel_safe # just so the compatibility import above is "used" and doesn't get removed by linter
class BaseExporter:
@@ -80,7 +80,7 @@ class BaseExporter:
def verbose_name(self) -> str:
"""
A human-readable name for this exporter. This should be short but
self-explaining. Good examples include 'JSON' or 'Microsoft Excel'.
self-explaining. Good examples include 'Orders as JSON' or 'Orders as Microsoft Excel'.
"""
raise NotImplementedError() # NOQA
@@ -137,6 +137,16 @@ class BaseExporter:
raise NotImplementedError() # NOQA
class OrganizerLevelExportMixin:
@property
def organizer_required_permission(self) -> str:
"""
The permission level required to use this exporter. Only useful for organizer-level exports,
not for event-level exports.
"""
return 'can_view_orders'
class ListExporter(BaseExporter):
ProgressSetTotal = namedtuple('ProgressSetTotal', 'total')