From 987fd4d1ba0ab105ae3565a068768e08e3551a5b Mon Sep 17 00:00:00 2001
From: alangsto <46360176+alangsto@users.noreply.github.com>
Date: Tue, 28 Jul 2020 16:43:16 -0400
Subject: [PATCH] Changes what fields are displayed depending on user role
(#22)
* hides fields based on user permissions
* updates for requested changes
---
.../ProctoredExamSettings.jsx | 126 +++++++++---------
.../ProctoredExamSettings.test.jsx | 45 ++++++-
2 files changed, 110 insertions(+), 61 deletions(-)
diff --git a/src/proctored-exam-settings/ProctoredExamSettings.jsx b/src/proctored-exam-settings/ProctoredExamSettings.jsx
index fc4bfa809..010b45692 100644
--- a/src/proctored-exam-settings/ProctoredExamSettings.jsx
+++ b/src/proctored-exam-settings/ProctoredExamSettings.jsx
@@ -28,6 +28,7 @@ function ExamSettings(props) {
const [saveError, setSaveError] = useState(false);
const [submissionInProgress, setSubmissionInProgress] = useState(false);
const [showProctortrackEscalationEmail, setShowProctortrackEscalationEmail] = useState(false);
+ const isEdxStaff = getAuthenticatedUser().administrator;
function onEnableProctoredExamsChange(event) {
setEnableProctoredExams(event.target.checked);
@@ -96,10 +97,8 @@ function ExamSettings(props) {
const currentDate = moment(moment()).format('YYYY-MM-DD[T]hh:mm:ss[Z]');
const isAfterCourseStart = currentDate > courseStartDate;
- const isAdmin = getAuthenticatedUser().administrator;
-
- // if the user is not an administrator and it is after the course start date, user cannot edit proctoring provider
- return !isAdmin && isAfterCourseStart;
+ // if the user is not edX staff and it is after the course start date, user cannot edit proctoring provider
+ return !isEdxStaff && isAfterCourseStart;
}
function isDisabledOption(provider) {
@@ -154,34 +153,38 @@ function ExamSettings(props) {
{/* ALLOW OPTING OUT OF PROCTORED EXAMS */}
-