mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-19 19:37:56 +00:00
fix: add missing perm checks on various whitelisted methods (#58652)
This commit is contained in:
@@ -56,7 +56,9 @@ class LedgerMerge(Document):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def form_start_merge(docname: str):
|
def form_start_merge(docname: str):
|
||||||
return frappe.get_doc("Ledger Merge", docname).start_merge()
|
lm_doc = frappe.get_doc("Ledger Merge", docname)
|
||||||
|
lm_doc.check_permission("write")
|
||||||
|
return lm_doc.start_merge()
|
||||||
|
|
||||||
|
|
||||||
def start_merge(docname):
|
def start_merge(docname):
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ def get_supplier_query(doctype: str, txt: str, searchfield: str, start: int, pag
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_payment_records(name: str, supplier: str, mode_of_payment: str | None = None):
|
def make_payment_records(name: str, supplier: str, mode_of_payment: str | None = None):
|
||||||
doc = frappe.get_doc("Payment Order", name)
|
doc = frappe.get_doc("Payment Order", name)
|
||||||
|
doc.check_permission()
|
||||||
make_journal_entry(doc, supplier, mode_of_payment)
|
make_journal_entry(doc, supplier, mode_of_payment)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ def start_pcv_processing(docname: str):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def pause_pcv_processing(docname: str):
|
def pause_pcv_processing(docname: str):
|
||||||
|
frappe.has_permission("Process Period Closing Voucher", ptype="write", doc=docname, throw=True)
|
||||||
|
|
||||||
ppcv = qb.DocType("Process Period Closing Voucher")
|
ppcv = qb.DocType("Process Period Closing Voucher")
|
||||||
qb.update(ppcv).set(ppcv.status, "Paused").where(ppcv.name.eq(docname)).run()
|
qb.update(ppcv).set(ppcv.status, "Paused").where(ppcv.name.eq(docname)).run()
|
||||||
|
|
||||||
@@ -157,6 +159,8 @@ def pause_pcv_processing(docname: str):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def cancel_pcv_processing(docname: str):
|
def cancel_pcv_processing(docname: str):
|
||||||
|
frappe.has_permission("Process Period Closing Voucher", ptype="cancel", doc=docname, throw=True)
|
||||||
|
|
||||||
ppcv = qb.DocType("Process Period Closing Voucher")
|
ppcv = qb.DocType("Process Period Closing Voucher")
|
||||||
qb.update(ppcv).set(ppcv.status, "Cancelled").where(ppcv.name.eq(docname)).run()
|
qb.update(ppcv).set(ppcv.status, "Cancelled").where(ppcv.name.eq(docname)).run()
|
||||||
|
|
||||||
@@ -171,6 +175,8 @@ def cancel_pcv_processing(docname: str):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def resume_pcv_processing(docname: str):
|
def resume_pcv_processing(docname: str):
|
||||||
|
frappe.has_permission("Process Period Closing Voucher", ptype="write", doc=docname, throw=True)
|
||||||
|
|
||||||
ppcv = qb.DocType("Process Period Closing Voucher")
|
ppcv = qb.DocType("Process Period Closing Voucher")
|
||||||
qb.update(ppcv).set(ppcv.status, "Running").where(ppcv.name.eq(docname)).run()
|
qb.update(ppcv).set(ppcv.status, "Running").where(ppcv.name.eq(docname)).run()
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ def start_payment_ledger_repost(docname: str | None = None):
|
|||||||
"""
|
"""
|
||||||
if docname:
|
if docname:
|
||||||
repost_doc = frappe.get_doc("Repost Payment Ledger", docname)
|
repost_doc = frappe.get_doc("Repost Payment Ledger", docname)
|
||||||
|
repost_doc.check_permission("submit")
|
||||||
if repost_doc.docstatus.is_submitted() and repost_doc.repost_status in ["Queued", "Failed"]:
|
if repost_doc.docstatus.is_submitted() and repost_doc.repost_status in ["Queued", "Failed"]:
|
||||||
try:
|
try:
|
||||||
for entry in repost_doc.repost_vouchers:
|
for entry in repost_doc.repost_vouchers:
|
||||||
|
|||||||
@@ -865,5 +865,6 @@ def calculate_total_purchase_cost(project: str | None = None):
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def update_costing_and_billing(project: str | None = None):
|
def update_costing_and_billing(project: str | None = None):
|
||||||
project = frappe.get_doc("Project", project)
|
project = frappe.get_doc("Project", project)
|
||||||
|
project.check_permission("write")
|
||||||
project.update_costing()
|
project.update_costing()
|
||||||
project.db_update()
|
project.db_update()
|
||||||
|
|||||||
@@ -655,4 +655,5 @@ def get_list_context(context=None):
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def update_delivery_note_status(docname: str, status: str):
|
def update_delivery_note_status(docname: str, status: str):
|
||||||
dn = frappe.get_lazy_doc("Delivery Note", docname)
|
dn = frappe.get_lazy_doc("Delivery Note", docname)
|
||||||
|
dn.check_permission("submit")
|
||||||
dn.update_status(status)
|
dn.update_status(status)
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ def transaction_processing(
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def retry(date: str | None = None):
|
def retry(date: str | None = None):
|
||||||
|
frappe.only_for("System Manager")
|
||||||
if not date:
|
if not date:
|
||||||
date = today()
|
date = today()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user