MDL-59195 assignsubmission_comments: fix permission checks
authorDavo Smith <davo.smith@synergy-learning.com>
Wed, 19 Jul 2017 15:31:52 +0000 (16:31 +0100)
committerDavo Smith <davo.smith@synergy-learning.com>
Mon, 21 Aug 2017 09:23:01 +0000 (10:23 +0100)
mod/assign/submission/comments/lib.php
mod/assign/submission/comments/locallib.php

index 09666b0..71caab6 100644 (file)
@@ -48,15 +48,6 @@ function assignsubmission_comments_comment_validate(stdClass $options) {
     if ($assignment->get_instance()->id != $submission->assignment) {
         throw new comment_exception('invalidcontext');
     }
     if ($assignment->get_instance()->id != $submission->assignment) {
         throw new comment_exception('invalidcontext');
     }
-    $canview = false;
-    if ($submission->userid) {
-        $canview = $assignment->can_view_submission($submission->userid);
-    } else {
-        $canview = $assignment->can_view_group_submission($submission->groupid);
-    }
-    if (!$canview) {
-        throw new comment_exception('nopermissiontocomment');
-    }
 
     return true;
 }
 
     return true;
 }
index 16ac94d..d3b4a3b 100644 (file)
@@ -69,7 +69,6 @@ class assign_submission_comments extends assign_submission_plugin {
         $options->displaycancel = true;
 
         $comment = new comment($options);
         $options->displaycancel = true;
 
         $comment = new comment($options);
-        $comment->set_view_permission(true);
 
         $o = $this->assignment->get_renderer()->container($comment->output(true), 'commentscontainer');
         return $o;
 
         $o = $this->assignment->get_renderer()->container($comment->output(true), 'commentscontainer');
         return $o;