diff --git a/.mergify.yml b/.mergify.yml
index e5f81c7e..22b72fb8 100644
--- a/.mergify.yml
+++ b/.mergify.yml
@@ -24,6 +24,16 @@ pull_request_rules:
assignees:
- "{{ author }}"
+ - name: backport to main-hotfix
+ conditions:
+ - label="backport main-hotfix"
+ actions:
+ backport:
+ branches:
+ - main-hotfix
+ assignees:
+ - "{{ author }}"
+
- name: backport to main
conditions:
- label="backport main"
diff --git a/crm/api/__init__.py b/crm/api/__init__.py
index cb56e3bd..54c72c02 100644
--- a/crm/api/__init__.py
+++ b/crm/api/__init__.py
@@ -3,7 +3,6 @@ from bs4 import BeautifulSoup
from frappe.core.api.file import get_max_file_size
from frappe.translate import get_all_translations
from frappe.utils import cstr, split_emails, validate_email_address
-from frappe.utils.modules import get_modules_from_all_apps_for_user
from frappe.utils.telemetry import POSTHOG_HOST_FIELD, POSTHOG_PROJECT_FIELD
@@ -64,11 +63,6 @@ def check_app_permission():
if frappe.session.user == "Administrator":
return True
- allowed_modules = get_modules_from_all_apps_for_user()
- allowed_modules = [x["module_name"] for x in allowed_modules]
- if "FCRM" not in allowed_modules:
- return False
-
roles = frappe.get_roles()
if any(
role in ["System Manager", "Sales User", "Sales Manager", "Sales Master Manager"] for role in roles
diff --git a/crm/api/contact.py b/crm/api/contact.py
index 6cab9c10..b8d8f578 100644
--- a/crm/api/contact.py
+++ b/crm/api/contact.py
@@ -23,11 +23,11 @@ def update_deals_email_mobile_no(doc):
@frappe.whitelist()
def get_contact(name):
- Contact = frappe.qb.DocType("Contact")
+ contact = frappe.get_doc("Contact", name)
+ contact.check_permission("read")
- query = frappe.qb.from_(Contact).select("*").where(Contact.name == name).limit(1)
+ contact = contact.as_dict()
- contact = query.run(as_dict=True)
if not len(contact):
frappe.throw(_("Contact not found"), frappe.DoesNotExistError)
contact = contact.pop()
diff --git a/crm/fcrm/doctype/crm_deal/api.py b/crm/fcrm/doctype/crm_deal/api.py
index 9b5ee368..5eaf2899 100644
--- a/crm/fcrm/doctype/crm_deal/api.py
+++ b/crm/fcrm/doctype/crm_deal/api.py
@@ -6,7 +6,10 @@ from crm.fcrm.doctype.crm_form_script.crm_form_script import get_form_script
@frappe.whitelist()
def get_deal(name):
- deal = frappe.get_doc("CRM Deal", name).as_dict()
+ deal = frappe.get_doc("CRM Deal", name)
+ deal.check_permission("read")
+
+ deal = deal.as_dict()
deal["fields_meta"] = get_fields_meta("CRM Deal")
deal["_form_script"] = get_form_script("CRM Deal")
diff --git a/crm/fcrm/doctype/crm_lead/api.py b/crm/fcrm/doctype/crm_lead/api.py
index 613cbb46..77e4fc58 100644
--- a/crm/fcrm/doctype/crm_lead/api.py
+++ b/crm/fcrm/doctype/crm_lead/api.py
@@ -6,7 +6,10 @@ from crm.fcrm.doctype.crm_form_script.crm_form_script import get_form_script
@frappe.whitelist()
def get_lead(name):
- lead = frappe.get_doc("CRM Lead", name).as_dict()
+ lead = frappe.get_doc("CRM Lead", name)
+ lead.check_permission("read")
+
+ lead = lead.as_dict()
lead["fields_meta"] = get_fields_meta("CRM Lead")
lead["_form_script"] = get_form_script("CRM Lead")
diff --git a/frontend/components.d.ts b/frontend/components.d.ts
index 648edc46..82afdb19 100644
--- a/frontend/components.d.ts
+++ b/frontend/components.d.ts
@@ -94,6 +94,7 @@ declare module 'vue' {
EmailTemplatesListView: typeof import('./src/components/ListViews/EmailTemplatesListView.vue')['default']
ERPNextIcon: typeof import('./src/components/Icons/ERPNextIcon.vue')['default']
ERPNextSettings: typeof import('./src/components/Settings/ERPNextSettings.vue')['default']
+ ErrorPage: typeof import('./src/components/ErrorPage.vue')['default']
ExotelCallUI: typeof import('./src/components/Telephony/ExotelCallUI.vue')['default']
ExportIcon: typeof import('./src/components/Icons/ExportIcon.vue')['default']
ExternalLinkIcon: typeof import('./src/components/Icons/ExternalLinkIcon.vue')['default']
diff --git a/frontend/src/components/ErrorPage.vue b/frontend/src/components/ErrorPage.vue
new file mode 100644
index 00000000..345ecfd7
--- /dev/null
+++ b/frontend/src/components/ErrorPage.vue
@@ -0,0 +1,24 @@
+
+