소스 검색

Fixing bug when dealing with user permissions see BT#6916

Julio Montoya 11 년 전
부모
커밋
67962ed43b
1개의 변경된 파일6개의 추가작업 그리고 4개의 파일을 삭제
  1. 6 4
      main/work/work.lib.php

+ 6 - 4
main/work/work.lib.php

@@ -2448,7 +2448,7 @@ function draw_date_picker($prefix, $default = '')
 }
 }
 
 
 /**
 /**
- * @param $prefix
+ * @param string $prefix
  * @param array of values
  * @param array of values
  * @return string
  * @return string
  *
  *
@@ -2464,7 +2464,7 @@ function get_date_from_select($prefix, $array = array())
 }
 }
 
 
 /**
 /**
- * Check if a user is the author of the item
+ * Check if a user is the author of a work document.
  * @param int $itemId
  * @param int $itemId
  * @param int $userId
  * @param int $userId
  * @param int $courseId
  * @param int $courseId
@@ -2487,6 +2487,7 @@ function user_is_author($itemId, $userId = null, $courseId = null, $sessionId =
     if ($is_allowed_to_edit) {
     if ($is_allowed_to_edit) {
         $isAuthor = true;
         $isAuthor = true;
     } else {
     } else {
+
         if (empty($courseId)) {
         if (empty($courseId)) {
             $courseId = api_get_course_int_id();
             $courseId = api_get_course_int_id();
         }
         }
@@ -2499,15 +2500,16 @@ function user_is_author($itemId, $userId = null, $courseId = null, $sessionId =
             $isAuthor = true;
             $isAuthor = true;
         }
         }
 
 
-        /*$workData = get_work_data_by_id($itemId);
+        $workData = get_work_data_by_id($itemId);
         if ($workData['user_id'] == $userId) {
         if ($workData['user_id'] == $userId) {
             $isAuthor = true;
             $isAuthor = true;
-        }*/
+        }
     }
     }
 
 
     if (!$isAuthor) {
     if (!$isAuthor) {
         return false;
         return false;
     }
     }
+
     return $isAuthor;
     return $isAuthor;
 }
 }