From 189afcf08b1e2a766ccf66ef3b0ee7ad6d40b2b1 Mon Sep 17 00:00:00 2001 From: KerollesFathy Date: Thu, 16 Apr 2026 17:32:17 +0000 Subject: [PATCH] fix(CustomHTMLBlock): validate private field in server-side --- .../desk/doctype/custom_html_block/custom_html_block.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frappe/desk/doctype/custom_html_block/custom_html_block.py b/frappe/desk/doctype/custom_html_block/custom_html_block.py index 837fcb3079..5a4df25453 100644 --- a/frappe/desk/doctype/custom_html_block/custom_html_block.py +++ b/frappe/desk/doctype/custom_html_block/custom_html_block.py @@ -4,6 +4,7 @@ import frappe from frappe.model.document import Document from frappe.query_builder.utils import DocType +from frappe.utils import has_common class CustomHTMLBlock(Document): @@ -23,7 +24,12 @@ class CustomHTMLBlock(Document): style: DF.Code | None # end: auto-generated types - pass + def validate(self): + self.validate_private() + + def validate_private(self): + if not has_common(frappe.get_roles(), ["Administrator", "System Manager", "Workspace Manager"]): + self.private = 1 @frappe.whitelist()