refactor: remove redundant share check in check_read_permission

has_permission() already checks for shared documents internally when
role permissions do not grant access, so the separate frappe.share.get_shared()
call was dead code.
This commit is contained in:
Sagar Vora 2025-12-02 00:19:44 +05:30
parent 5297edc732
commit bcac30836b

View file

@ -1154,12 +1154,10 @@ class Engine:
)
if not has_permission("select") and not has_permission("read"):
# Check for shared documents
if not frappe.share.get_shared(self.doctype, self.user):
frappe.throw(
_("Insufficient Permission for {0}").format(frappe.bold(self.doctype)),
frappe.PermissionError,
)
frappe.throw(
_("Insufficient Permission for {0}").format(frappe.bold(self.doctype)),
frappe.PermissionError,
)
def apply_field_permissions(self):
"""Filter the list of fields based on permlevel."""