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()