Skip to content

Commit

Permalink
fix: check permission before print or download document (#18757) (#18785
Browse files Browse the repository at this point in the history
)

(cherry picked from commit 62c4a3c)

Co-authored-by: Daizy Modi <modidaizy5217@gmail.com>
  • Loading branch information
mergify[bot] and DaizyModi committed Nov 6, 2022
1 parent aa68138 commit 9b5225f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions frappe/utils/weasyprint.py
Expand Up @@ -9,6 +9,7 @@
@frappe.whitelist()
def download_pdf(doctype, name, print_format, letterhead=None):
doc = frappe.get_doc(doctype, name)
doc.check_permission("print")
generator = PrintFormatGenerator(print_format, doc, letterhead)
pdf = generator.render_pdf()

Expand All @@ -21,6 +22,7 @@ def download_pdf(doctype, name, print_format, letterhead=None):

def get_html(doctype, name, print_format, letterhead=None):
doc = frappe.get_doc(doctype, name)
doc.check_permission("print")
generator = PrintFormatGenerator(print_format, doc, letterhead)
return generator.get_html_preview()

Expand Down

0 comments on commit 9b5225f

Please sign in to comment.