From 400f879d292cfdd69386ef3880ef766d1fbc68bc Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 26 Mar 2025 14:44:40 +0530 Subject: [PATCH] fix: only allow invite by email for Sales Manager & Sales User role --- crm/api/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crm/api/__init__.py b/crm/api/__init__.py index f0dcf649..8c6efd40 100644 --- a/crm/api/__init__.py +++ b/crm/api/__init__.py @@ -94,8 +94,13 @@ def accept_invitation(key: str | None = None): @frappe.whitelist() def invite_by_email(emails: str, role: str): frappe.only_for("Sales Manager") + + if role not in ["Sales Manager", "Sales User"]: + frappe.throw("Cannot invite for this role") + if not emails: return + email_string = validate_email_address(emails, throw=False) email_list = split_emails(email_string) if not email_list: