Merge branch 'MDL-32239' of git://github.com/timhunt/moodle
[moodle.git] / question / editlib.php
index 44f744f..85c7f92 100644 (file)
@@ -606,7 +606,8 @@ abstract class question_bank_action_column_base extends question_bank_column_bas
     }
 
     public function get_required_fields() {
     }
 
     public function get_required_fields() {
-        return array('q.id');
+        // createdby is required for permission checks.
+        return array('q.id, q.createdby');
     }
 }
 
     }
 }
 
@@ -632,10 +633,9 @@ class question_bank_edit_action_column extends question_bank_action_column_base
     }
 
     protected function display_content($question, $rowclasses) {
     }
 
     protected function display_content($question, $rowclasses) {
-        if (question_has_capability_on($question, 'edit') ||
-                question_has_capability_on($question, 'move')) {
+        if (question_has_capability_on($question, 'edit')) {
             $this->print_icon('t/edit', $this->stredit, $this->qbank->edit_question_url($question->id));
             $this->print_icon('t/edit', $this->stredit, $this->qbank->edit_question_url($question->id));
-        } else {
+        } else if (question_has_capability_on($question, 'view')) {
             $this->print_icon('i/info', $this->strview, $this->qbank->edit_question_url($question->id));
         }
     }
             $this->print_icon('i/info', $this->strview, $this->qbank->edit_question_url($question->id));
         }
     }