From 3881179f723ce21986ba8a683ef5ab9d851e7aae Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Sun, 13 Apr 2025 19:59:23 +0530 Subject: [PATCH] fix: restrict app in apps page if no access to FCRM module --- crm/api/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crm/api/__init__.py b/crm/api/__init__.py index 54c72c02..af960c47 100644 --- a/crm/api/__init__.py +++ b/crm/api/__init__.py @@ -63,6 +63,11 @@ 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 + roles = frappe.get_roles() if any( role in ["System Manager", "Sales User", "Sales Manager", "Sales Master Manager"] for role in roles