Skip to content

Commit 4dbbbc1

Browse files
committed
fix: permission check for listing wiki in /apps
1 parent a7f9342 commit 4dbbbc1

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

wiki/hooks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"logo": "/assets/wiki/images/wiki-logo.png",
1414
"title": "Wiki",
1515
"route": "/app/wiki",
16-
# "has_permission": "erpnext.check_app_permission",
16+
"has_permission": "wiki.utils.check_app_permission",
1717
}
1818
]
1919

wiki/utils.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import frappe
2+
3+
4+
def check_app_permission():
5+
"""Check if user has permission to access the app (for showing the app on app screen)"""
6+
7+
if frappe.session.user != "Administrator":
8+
return True
9+
10+
roles = frappe.get_roles()
11+
if "Wiki Approver" in roles:
12+
return True
13+
14+
return False

0 commit comments

Comments
 (0)