feat: app switcher
This commit is contained in:
16
lms/hooks.py
16
lms/hooks.py
@@ -4,9 +4,11 @@ app_name = "frappe_lms"
|
||||
app_title = "Frappe LMS"
|
||||
app_publisher = "Frappe"
|
||||
app_description = "Frappe LMS App"
|
||||
app_icon = "octicon octicon-file-directory"
|
||||
app_icon_url = "/assets/lms/images/lms-logo.png"
|
||||
app_icon_title = "Learning"
|
||||
app_icon_route = "/lms"
|
||||
app_color = "grey"
|
||||
app_email = "school@frappe.io"
|
||||
app_email = "jannat@frappe.io"
|
||||
app_license = "AGPL"
|
||||
|
||||
# Includes in <head>
|
||||
@@ -61,8 +63,6 @@ web_include_js = ["website.bundle.js"]
|
||||
after_install = "lms.install.after_install"
|
||||
after_sync = "lms.install.after_sync"
|
||||
before_uninstall = "lms.install.before_uninstall"
|
||||
|
||||
|
||||
setup_wizard_requires = "assets/lms/js/setup_wizard.js"
|
||||
|
||||
# Desk Notifications
|
||||
@@ -231,3 +231,11 @@ profile_url_prefix = "/users/"
|
||||
signup_form_template = "lms.plugins.show_custom_signup"
|
||||
|
||||
on_session_creation = "lms.overrides.user.on_session_creation"
|
||||
|
||||
add_to_apps_screen = [{
|
||||
"name": "lms",
|
||||
"logo": "/assets/lms/images/lms-logo.png",
|
||||
"title": "Learning",
|
||||
"route": "/lms",
|
||||
"has_permission": "lms.lms.api.check_app_permission"
|
||||
}]
|
||||
@@ -597,3 +597,15 @@ def get_members(start=0, search=""):
|
||||
member.role = "LMS Student"
|
||||
|
||||
return members
|
||||
|
||||
def check_app_permission():
|
||||
"""Check if the user has permission to access the app."""
|
||||
if frappe.session.user == "Administrator":
|
||||
return True
|
||||
|
||||
roles = frappe.get_roles()
|
||||
lms_roles = ["Moderator", "Course Creator", "Batch Evaluator", "LMS Student"]
|
||||
if any(role in roles for role in lms_roles):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
BIN
lms/public/images/desk.png
Normal file
BIN
lms/public/images/desk.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Reference in New Issue
Block a user