fix: add perm check on unfollow doc

This commit is contained in:
Shrihari Mahabal 2026-04-29 13:55:21 +05:30
parent 56c602e94d
commit a87e2654c7

View file

@ -77,7 +77,7 @@ def follow_document(doctype: str, doc_name: str, user: str) -> Document | bool:
@frappe.whitelist()
def unfollow_document(doctype: str, doc_name: str, user: str) -> bool:
if user != frappe.session.user:
if user != frappe.session.user and not frappe.has_permission("Document Follow", "write"):
frappe.throw(_("You can only unfollow documents for yourself."), frappe.PermissionError)
doc = frappe.get_all(