fix: Apply field permlevel for doc GET via REST

This commit is contained in:
Gavin D'souza 2022-12-26 16:18:14 +05:30
parent 92a705f8fd
commit 84ccf3d128
2 changed files with 3 additions and 0 deletions

View file

@ -131,6 +131,7 @@ class _RESTAPIHandler:
doc = frappe.get_doc(self.doctype, self.name)
if not doc.has_permission("read"):
raise frappe.PermissionError
doc.apply_fieldlevel_read_permissions()
frappe.local.response.update({"data": doc})
def update_doc(self):

View file

@ -86,6 +86,8 @@ def get(doctype, name=None, filters=None, parent=None):
doc = frappe.get_doc(doctype) # single
doc.check_permission()
doc.apply_fieldlevel_read_permissions()
return doc.as_dict()