From 3ca4cf9ed24ce2bc123d26d15b5bf3337cf7f36d Mon Sep 17 00:00:00 2001 From: Ghassan Maslamani Date: Mon, 30 Sep 2024 15:58:40 +0200 Subject: [PATCH] fix: don't show studio link when user is lmited_staff --- .../templates/legacy/staff_area/oa_staff_area.html | 4 +++- openassessment/xblock/openassessmentblock.py | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/openassessment/templates/legacy/staff_area/oa_staff_area.html b/openassessment/templates/legacy/staff_area/oa_staff_area.html index 55c352ffe7..48be009384 100644 --- a/openassessment/templates/legacy/staff_area/oa_staff_area.html +++ b/openassessment/templates/legacy/staff_area/oa_staff_area.html @@ -22,7 +22,9 @@ {% endif %} {% endif %} {% endif %} - + {% if not is_limited_staff %} + + {% endif %}
diff --git a/openassessment/xblock/openassessmentblock.py b/openassessment/xblock/openassessmentblock.py index f950a7909d..4179837344 100644 --- a/openassessment/xblock/openassessmentblock.py +++ b/openassessment/xblock/openassessmentblock.py @@ -633,12 +633,16 @@ def student_view(self, context=None): # pylint: disable=unused-argument leaderboard_model = model # All data we intend to pass to the front end. + show_staff_area = self.is_course_staff and not self.in_studio_preview + block_user = self.runtime.service(self, "user").get_current_user() + is_limited_staff = show_staff_area and not and not has_studio_read_access(block_user,self.course_id) context_dict = { "leaderboard_modal": leaderboard_model, "prompts": self.prompts, "prompts_type": self.prompts_type, "rubric_assessments": ui_models, - "show_staff_area": self.is_course_staff and not self.in_studio_preview, + "show_staff_area": show_staff_area, + "is_limited_staff": is_limited_staff, "title": self.title, "xblock_id": self.get_xblock_id(), "course_id": self.course_id,