Просмотр исходного кода

student boss cannot edit exercise result see BT#12702

jmontoyaa 7 лет назад
Родитель
Сommit
4b75374220
1 измененных файлов с 8 добавлено и 5 удалено
  1. 8 5
      main/exercise/exercise_show.php

+ 8 - 5
main/exercise/exercise_show.php

@@ -39,10 +39,12 @@ $student_id = $track_exercise_info['exe_user_id'];
 $learnpath_id = $track_exercise_info['orig_lp_id'];
 $learnpath_id = $track_exercise_info['orig_lp_id'];
 $learnpath_item_id = $track_exercise_info['orig_lp_item_id'];
 $learnpath_item_id = $track_exercise_info['orig_lp_item_id'];
 $lp_item_view_id = $track_exercise_info['orig_lp_item_view_id'];
 $lp_item_view_id = $track_exercise_info['orig_lp_item_view_id'];
-
+$isBossOfStudent = false;
 if (api_is_student_boss()) {
 if (api_is_student_boss()) {
     // Check if boss has access to user info.
     // Check if boss has access to user info.
-    if (UserManager::userIsBossOfStudent($currentUserId, $student_id) == false) {
+    if (UserManager::userIsBossOfStudent($currentUserId, $student_id)) {
+        $isBossOfStudent = true;
+    } else {
         api_not_allowed($printHeaders);
         api_not_allowed($printHeaders);
     }
     }
 } else {
 } else {
@@ -662,16 +664,18 @@ foreach ($questionList as $questionId) {
         if ($is_allowedToEdit &&
         if ($is_allowedToEdit &&
             $locked == false &&
             $locked == false &&
             !api_is_drh() &&
             !api_is_drh() &&
-            !api_is_student_boss() &&
             $isCoachAllowedToEdit
             $isCoachAllowedToEdit
         ) {
         ) {
             $isFeedbackAllowed = true;
             $isFeedbackAllowed = true;
         } elseif (!$isCoachAllowedToEdit && $allowCoachFeedbackExercises) {
         } elseif (!$isCoachAllowedToEdit && $allowCoachFeedbackExercises) {
             $isFeedbackAllowed = true;
             $isFeedbackAllowed = true;
         }
         }
+        // Boss cannot edit exercise result
+        if ($isBossOfStudent) {
+            $isFeedbackAllowed = false;
+        }
 
 
         $marksname = '';
         $marksname = '';
-
         if ($isFeedbackAllowed) {
         if ($isFeedbackAllowed) {
             $name = "fckdiv".$questionId;
             $name = "fckdiv".$questionId;
             $marksname = "marksName".$questionId;
             $marksname = "marksName".$questionId;
@@ -951,7 +955,6 @@ if ($isFeedbackAllowed && $origin != 'learnpath' && $origin != 'student_progress
         false,
         false,
         ['onclick' => "getFCK('$strids', '$marksid')"]
         ['onclick' => "getFCK('$strids', '$marksid')"]
     );
     );
-
     echo $emailForm->returnForm();
     echo $emailForm->returnForm();
 }
 }