Merge pull request #735 from shariquerik/restrict-app-if-no-module-access-1

This commit is contained in:
Shariq Ansari 2025-04-13 20:07:47 +05:30 committed by GitHub
commit dce17de000
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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