Changeset 15968 for main/waeup.kofa/trunk/src/waeup/kofa/browser
- Timestamp:
- 30 Jan 2020, 22:47:56 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/reports.py
r14628 r15968 27 27 from waeup.kofa.interfaces import MessageFactory as _ 28 28 from waeup.kofa.browser.layout import KofaPage, jsaction 29 from waeup.kofa.utils.helpers import get_current_principal 29 from waeup.kofa.utils.helpers import get_current_principal, get_user_account 30 30 from waeup.kofa.reports import ( 31 31 IReportsContainer, IReportGenerator, get_generators) … … 142 142 label = _('Create report') 143 143 144 locally_allowed_reports = ( 145 'level_report', 'raw_score_report', 'session_results_presentation') 146 144 147 def update(self, START_GENERATOR=None, generator=None): 145 148 utils = queryUtility(IKofaUtils) … … 162 165 being a human readable description of the respective generator 163 166 and ``<NAME>`` being the registration name with the ZCA. 167 168 If `waeup.local.ReportsOfficer` role has been assigned at 169 department level, list only report generator which allow 170 to filter department data. 164 171 """ 165 result = [(gen.title, name) for name, gen in get_generators()] 172 try: 173 local_roles = get_user_account(self.request).getLocalRoles() 174 except AttributeError: # Managers have no user account 175 local_roles = {} 176 lror = local_roles.get('waeup.local.ReportsOfficer', None) 177 if lror: 178 result = [(gen.title, name) for name, gen in get_generators() 179 if name in self.locally_allowed_reports] 180 else: 181 result = [(gen.title, name) for name, gen in get_generators()] 166 182 sorted_result = sorted(result, key=lambda value:value[1]) 167 183 return sorted_result
Note: See TracChangeset for help on using the changeset viewer.