Browse Source

Should fix bug BT#6294 when uploading a file the itemproperty.insert_user_id is not correctly saved, we now take the student_publication.user_id to identify the author.

Julio Montoya 11 years ago
parent
commit
a663258f59
1 changed files with 7 additions and 2 deletions
  1. 7 2
      main/work/work.lib.php

+ 7 - 2
main/work/work.lib.php

@@ -1616,12 +1616,17 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher
 			$is_author  = false;
             $can_read   = false;
 
+            $owner_id = $work['user_id'];
 
-			$item_property_data = api_get_item_property_info(api_get_course_int_id(), 'work', $item_id, api_get_session_id());
+            /* Because a bug found when saving items using the api_item_property_update()
+               the field $item_property_data['insert_user_id'] is not reliable. */
 
-			if (!$is_allowed_to_edit && $item_property_data['insert_user_id'] == api_get_user_id()) {
+			// $item_property_data = api_get_item_property_info(api_get_course_int_id(), 'work', $item_id, api_get_session_id());
+			//if (!$is_allowed_to_edit && $item_property_data['insert_user_id'] == api_get_user_id()) {
+            if (!$is_allowed_to_edit && $owner_id == api_get_user_id()) {
 				$is_author = true;
 			}
+
             if ($course_info['show_score'] == 0 ) {
                 $can_read = true;
             }