From fb9b026ad620ead63bc121dd6b505ec7b5196cb6 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 14 Apr 2025 11:05:43 +0530 Subject: [PATCH] fix: restrict app in apps page if no access to FCRM module --- crm/api/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crm/api/__init__.py b/crm/api/__init__.py index 5f021517..cb56e3bd 100644 --- a/crm/api/__init__.py +++ b/crm/api/__init__.py @@ -3,6 +3,7 @@ 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 @@ -63,10 +64,10 @@ def check_app_permission(): if frappe.session.user == "Administrator": return True - # allowed_modules = frappe.utils.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 + 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(