Skip to content

Commit

Permalink
fix: permission check for listing wiki in /apps
Browse files Browse the repository at this point in the history
  • Loading branch information
AyshaHakeem committed Dec 10, 2024
1 parent a7f9342 commit 4dbbbc1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion wiki/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"logo": "/assets/wiki/images/wiki-logo.png",
"title": "Wiki",
"route": "/app/wiki",
# "has_permission": "erpnext.check_app_permission",
"has_permission": "wiki.utils.check_app_permission",
}
]

Expand Down
14 changes: 14 additions & 0 deletions wiki/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import frappe


def check_app_permission():
"""Check if user has permission to access the app (for showing the app on app screen)"""

if frappe.session.user != "Administrator":
return True

roles = frappe.get_roles()
if "Wiki Approver" in roles:
return True

return False

0 comments on commit 4dbbbc1

Please sign in to comment.