From 8b7089e5210d39797e1cbed770df73a58fbcbe52 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 14 Apr 2025 11:07:09 +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 11cc039e..fe6f1fb5 100644 --- a/crm/api/__init__.py +++ b/crm/api/__init__.py @@ -1,5 +1,6 @@ import frappe from bs4 import BeautifulSoup +from frappe.config import get_modules_from_all_apps_for_user 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 @@ -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(