fix: profile slot and schedule tab visibility

This commit is contained in:
Jannat Patel
2025-11-10 12:09:51 +05:30
parent d5c5faf0ca
commit fff9769791
10 changed files with 54 additions and 28 deletions
+9 -2
View File
@@ -190,15 +190,22 @@ const isSessionUser = () => {
return $user.data?.email === profile.data?.email return $user.data?.email === profile.data?.email
} }
const hasHigherAccess = () => { const currentUserHasHigherAccess = () => {
return $user.data?.is_evaluator || $user.data?.is_moderator return $user.data?.is_evaluator || $user.data?.is_moderator
} }
const isEvaluatorOrModerator = () => {
return (
profile.data?.roles?.includes('Batch Evaluator') ||
profile.data?.roles?.includes('Moderator')
)
}
const getTabButtons = () => { const getTabButtons = () => {
let buttons = [{ label: 'About' }, { label: 'Certificates' }] let buttons = [{ label: 'About' }, { label: 'Certificates' }]
if ($user.data?.is_moderator) buttons.push({ label: 'Roles' }) if ($user.data?.is_moderator) buttons.push({ label: 'Roles' })
if (hasHigherAccess()) { if (currentUserHasHigherAccess() && isEvaluatorOrModerator()) {
buttons.push({ label: 'Slots' }) buttons.push({ label: 'Slots' })
buttons.push({ label: 'Schedule' }) buttons.push({ label: 'Schedule' })
} }
+4 -1
View File
@@ -1674,9 +1674,12 @@ def get_pwa_manifest():
@frappe.whitelist() @frappe.whitelist()
def get_profile_details(username): def get_profile_details(username):
return frappe.db.get_value( details = frappe.db.get_value(
"User", "User",
{"username": username}, {"username": username},
["full_name", "name", "username", "user_image", "bio", "headline", "cover_image"], ["full_name", "name", "username", "user_image", "bio", "headline", "cover_image"],
as_dict=True, as_dict=True,
) )
details.roles = frappe.get_roles(details.name)
return details
@@ -83,8 +83,8 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2025-07-04 12:04:11.007945", "modified": "2025-11-10 11:41:51.802016",
"modified_by": "Administrator", "modified_by": "sayali@frappe.io",
"module": "LMS", "module": "LMS",
"name": "Course Evaluator", "name": "Course Evaluator",
"naming_rule": "By fieldname", "naming_rule": "By fieldname",
@@ -131,5 +131,6 @@
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"states": [], "states": [],
"title_field": "full_name" "title_field": "full_name",
"track_changes": 1
} }
@@ -70,10 +70,11 @@
"fieldtype": "Section Break" "fieldtype": "Section Break"
} }
], ],
"grid_page_length": 50,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2024-12-24 09:36:31.464508", "modified": "2025-11-10 11:40:38.157448",
"modified_by": "Administrator", "modified_by": "sayali@frappe.io",
"module": "LMS", "module": "LMS",
"name": "LMS Assignment", "name": "LMS Assignment",
"naming_rule": "Expression (old style)", "naming_rule": "Expression (old style)",
@@ -113,9 +114,11 @@
"share": 1 "share": 1
} }
], ],
"row_format": "Dynamic",
"show_title_field_in_link": 1, "show_title_field_in_link": 1,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"states": [], "states": [],
"title_field": "title" "title_field": "title",
} "track_changes": 1
}
@@ -84,7 +84,7 @@
"grid_page_length": 50, "grid_page_length": 50,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2025-11-06 11:38:35.903520", "modified": "2025-11-10 11:39:42.233779",
"modified_by": "sayali@frappe.io", "modified_by": "sayali@frappe.io",
"module": "LMS", "module": "LMS",
"name": "LMS Badge Assignment", "name": "LMS Badge Assignment",
@@ -166,5 +166,6 @@
"sort_field": "creation", "sort_field": "creation",
"sort_order": "DESC", "sort_order": "DESC",
"states": [], "states": [],
"title_field": "member" "title_field": "member",
"track_changes": 1
} }
@@ -131,10 +131,11 @@
"read_only": 1 "read_only": 1
} }
], ],
"grid_page_length": 50,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2024-09-11 11:20:06.233491", "modified": "2025-11-10 11:41:38.999620",
"modified_by": "Administrator", "modified_by": "sayali@frappe.io",
"module": "LMS", "module": "LMS",
"name": "LMS Certificate Evaluation", "name": "LMS Certificate Evaluation",
"owner": "Administrator", "owner": "Administrator",
@@ -164,6 +165,7 @@
"write": 1 "write": 1
} }
], ],
"row_format": "Dynamic",
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"states": [ "states": [
@@ -184,5 +186,6 @@
"title": "In Progress" "title": "In Progress"
} }
], ],
"title_field": "member_name" "title_field": "member_name",
} "track_changes": 1
}
@@ -157,7 +157,7 @@
"grid_page_length": 50, "grid_page_length": 50,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2025-10-13 14:30:57.897102", "modified": "2025-11-10 11:40:50.679211",
"modified_by": "sayali@frappe.io", "modified_by": "sayali@frappe.io",
"module": "LMS", "module": "LMS",
"name": "LMS Certificate Request", "name": "LMS Certificate Request",
@@ -228,5 +228,6 @@
"title": "Cancelled" "title": "Cancelled"
} }
], ],
"title_field": "member_name" "title_field": "member_name",
"track_changes": 1
} }
@@ -193,11 +193,12 @@
"label": "Possible Answer 4" "label": "Possible Answer 4"
} }
], ],
"grid_page_length": 50,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"make_attachments_public": 1, "make_attachments_public": 1,
"modified": "2024-10-07 09:41:17.862774", "modified": "2025-11-10 11:40:18.568547",
"modified_by": "Administrator", "modified_by": "sayali@frappe.io",
"module": "LMS", "module": "LMS",
"name": "LMS Question", "name": "LMS Question",
"naming_rule": "Expression", "naming_rule": "Expression",
@@ -240,8 +241,10 @@
"write": 1 "write": 1
} }
], ],
"row_format": "Dynamic",
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"states": [], "states": [],
"title_field": "question" "title_field": "question",
} "track_changes": 1
}
+7 -4
View File
@@ -18,10 +18,11 @@
"unique": 1 "unique": 1
} }
], ],
"grid_page_length": 50,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2023-10-26 17:25:09.144367", "modified": "2025-11-10 11:39:57.251861",
"modified_by": "Administrator", "modified_by": "sayali@frappe.io",
"module": "LMS", "module": "LMS",
"name": "LMS Source", "name": "LMS Source",
"naming_rule": "By fieldname", "naming_rule": "By fieldname",
@@ -62,8 +63,10 @@
"share": 1 "share": 1
} }
], ],
"row_format": "Dynamic",
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"states": [], "states": [],
"title_field": "source" "title_field": "source",
} "track_changes": 1
}
@@ -83,7 +83,7 @@
"grid_page_length": 50, "grid_page_length": 50,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2025-07-08 12:20:48.314056", "modified": "2025-11-10 11:39:13.146961",
"modified_by": "sayali@frappe.io", "modified_by": "sayali@frappe.io",
"module": "LMS", "module": "LMS",
"name": "LMS Zoom Settings", "name": "LMS Zoom Settings",
@@ -131,5 +131,6 @@
"row_format": "Dynamic", "row_format": "Dynamic",
"sort_field": "creation", "sort_field": "creation",
"sort_order": "DESC", "sort_order": "DESC",
"states": [] "states": [],
"track_changes": 1
} }