From cd6644d56869b13edbfde1b9f98b41b16b33dc84 Mon Sep 17 00:00:00 2001 From: Ejaaz Khan <67804911+iamejaaz@users.noreply.github.com> Date: Tue, 3 Jun 2025 17:03:54 +0530 Subject: [PATCH] Revert "fix: exclude if owner from accessing all report" --- frappe/desk/query_report.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frappe/desk/query_report.py b/frappe/desk/query_report.py index 5a371bc34d..7810bba752 100644 --- a/frappe/desk/query_report.py +++ b/frappe/desk/query_report.py @@ -14,7 +14,7 @@ from frappe.desk.reportview import clean_params, parse_json from frappe.model.utils import render_include from frappe.modules import get_module_path, scrub from frappe.monitor import add_data_to_monitor -from frappe.permissions import get_role_permissions, get_valid_perms, has_permission +from frappe.permissions import get_role_permissions, has_permission from frappe.utils import cint, cstr, flt, format_duration, get_html_format, sbool @@ -710,8 +710,10 @@ def has_match( # so that even if one of the sets allows a match, it is true if match: - valid_perms = get_valid_perms(doctype=ref_doctype) - match = any(perm.get("read") and not perm.get("if_owner") for perm in valid_perms) + if not frappe.has_permission( + doctype=ref_doctype, ptype="read", throw=False, ignore_share_permissions=True + ): + match = False matched_for_doctype = matched_for_doctype or match