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 <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2025-02-12 17:30:52 +05:30
parent 00fb8e7a7a
commit 80d20ff745
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F

View file

@ -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: