fix(apps): don't skip app if no permission hook (#32492)

Fixes 2077e90bf1

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2025-05-13 15:41:50 +05:30 committed by GitHub
parent e0df5ee076
commit 28701e7951
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,20 +21,20 @@ def get_apps():
if not len(app_details):
continue
for app_detail in app_details:
if has_permission_path := app_detail.get("has_permission"):
try:
if not frappe.get_attr(has_permission_path)():
continue
app_list.append(
{
"name": app,
"logo": app_detail.get("logo"),
"title": _(app_detail.get("title")),
"route": app_detail.get("route"),
}
)
except Exception:
frappe.log_error(f"Failed to call has_permission hook ({has_permission_path}) for {app}")
try:
has_permission_path = app_detail.get("has_permission")
if has_permission_path and not frappe.get_attr(has_permission_path)():
continue
app_list.append(
{
"name": app,
"logo": app_detail.get("logo"),
"title": _(app_detail.get("title")),
"route": app_detail.get("route"),
}
)
except Exception:
frappe.log_error(f"Failed to call has_permission hook ({has_permission_path}) for {app}")
return app_list