From b32cbb18a98dea70354dc59b36e590cd213ee7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 12 Sep 2024 16:09:39 +0200 Subject: [PATCH] Check read access of report records Closes #13505 --- trytond/CHANGELOG | 1 + trytond/trytond/report/report.py | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/trytond/CHANGELOG b/trytond/CHANGELOG index cb25e4ea48..cb0a8f11dd 100644 --- a/trytond/CHANGELOG +++ b/trytond/CHANGELOG @@ -1,3 +1,4 @@ +* Check read access of report records (#13505) * Forbid editing cron when it is running * Store last cron durations * Use JSONB to store MultiSelection field by default diff --git a/trytond/trytond/report/report.py b/trytond/trytond/report/report.py index 33a6609fbf..119d889e27 100644 --- a/trytond/trytond/report/report.py +++ b/trytond/trytond/report/report.py @@ -39,7 +39,7 @@ from trytond.i18n import gettext from trytond.pool import Pool, PoolBase from trytond.rpc import RPC from trytond.tools import slugify -from trytond.transaction import Transaction +from trytond.transaction import Transaction, check_access from trytond.url import URLMixin try: @@ -172,6 +172,7 @@ class Report(URLMixin, PoolBase): ''' pool = Pool() ActionReport = pool.get('ir.action.report') + ModelAccess = pool.get('ir.model.access') cls.check_access() context = Transaction().context ids = list(map(int, ids)) @@ -218,6 +219,13 @@ class Report(URLMixin, PoolBase): if model: records = cls._get_records(ids, model, data) + with check_access(): + if model: + Model = pool.get(model) + ModelAccess.check(model, 'read') + # Check read access + Model.read(ids, ['id']) + if not records: groups = [[]] headers = [{}]