Browse Source

Block upload if setting allow_only_one_student_publication_per_user on

BT#15028
Julio 6 years ago
parent
commit
d1931fe6de
1 changed files with 8 additions and 0 deletions
  1. 8 0
      main/inc/ajax/work.ajax.php

+ 8 - 0
main/inc/ajax/work.ajax.php

@@ -20,6 +20,14 @@ switch ($action) {
         $userId = api_get_user_id();
         $groupId = api_get_group_id();
 
+        $onlyOnePublication = api_get_configuration_value('allow_only_one_student_publication_per_user');
+        if ($onlyOnePublication) {
+            $count =  get_work_count_by_student($userId, $workId);
+            if ($count >= 1) {
+                exit;
+            }
+        }
+
         if (!empty($_FILES)) {
             $files = $_FILES['files'];
             $fileList = [];