From 7be9eb09e8ef030e49d9ea72e9ee3a63e1a3730f Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Tue, 11 Apr 2023 17:09:38 +0530 Subject: [PATCH] fix: exponse class info only to moderators --- lms/www/classes/class.html | 5 ++--- lms/www/classes/index.html | 4 +++- lms/www/classes/index.py | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lms/www/classes/class.html b/lms/www/classes/class.html index 5c23dfce..1df30575 100644 --- a/lms/www/classes/class.html +++ b/lms/www/classes/class.html @@ -285,9 +285,8 @@ {%- block script %} {{ super() }} - + {% if is_moderator %} + {% endif %} {{ include_script('controls.bundle.js') }} {% endblock %} diff --git a/lms/www/classes/index.html b/lms/www/classes/index.html index 0b9980f8..69b62d2f 100644 --- a/lms/www/classes/index.html +++ b/lms/www/classes/index.html @@ -6,7 +6,7 @@ {% block page_content %}
- {% if has_course_moderator_role() %} + {% if is_moderator %} @@ -30,9 +30,11 @@ {%- block script %} {{ super() }} {{ include_script('controls.bundle.js') }} + {% if is_moderator %} + {% endif %} {% endblock %} {% macro ClassCards(classes) %} diff --git a/lms/www/classes/index.py b/lms/www/classes/index.py index cb28b46d..90875fc0 100644 --- a/lms/www/classes/index.py +++ b/lms/www/classes/index.py @@ -1,10 +1,11 @@ import frappe from frappe.utils import getdate +from lms.lms.utils import has_course_moderator_role def get_context(context): context.no_cache = 1 - + context.is_moderator = has_course_moderator_role() context.classes = frappe.get_all( "LMS Class", {"end_date": [">=", getdate()]},