From 80d20ff745e6240fb3a4206cff037bb37b25e4e3 Mon Sep 17 00:00:00 2001 From: Akhil Narang Date: Wed, 12 Feb 2025 17:30:52 +0530 Subject: [PATCH] fix(get_linked_docs): check if user can read doctype before fetching a list Users might not have access to all the possible linked doctypes - they should still be able to access the others Signed-off-by: Akhil Narang --- frappe/desk/form/linked_with.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frappe/desk/form/linked_with.py b/frappe/desk/form/linked_with.py index e2641aa856..d2878d464b 100644 --- a/frappe/desk/form/linked_with.py +++ b/frappe/desk/form/linked_with.py @@ -430,6 +430,10 @@ def get_linked_docs(doctype: str, name: str, linkinfo: dict | None = None) -> di is_target_doctype_table = frappe.get_meta(doctype).istable for linked_doctype, link_context in linkinfo.items(): + # Don't try to fetch linked documents if the user can't read the doctype + if not frappe.has_permission(linked_doctype): + continue + linked_doctype_meta = frappe.get_meta(linked_doctype) if linked_doctype_meta.issingle: