diff --git a/mod/assign/classes/output/actionmenu.php b/mod/assign/classes/output/actionmenu.php
index 23dca8a0957..1f99921c277 100644
--- a/mod/assign/classes/output/actionmenu.php
+++ b/mod/assign/classes/output/actionmenu.php
@@ -14,14 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-/**
- * Output the actionbar for this activity.
- *
- * @package mod_assign
- * @copyright 2021 Adrian Greeve
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
namespace mod_assign\output;
use templatable;
@@ -56,10 +48,14 @@ class actionmenu implements templatable, renderable {
* @return array Data to be used for a template.
*/
public function export_for_template(\renderer_base $output): array {
- return [
- 'submissionlink' => (new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'grading']))->out(false),
- 'gradelink' => (new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'grader']))->out(false)
- ];
- }
+ $submissionlink = new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'grading']);
+ $return = ['submissionlink' => $submissionlink->out(false)];
+ if (has_capability('mod/assign:grade', \context_module::instance($this->cmid))) {
+ $gradelink = new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'grader']);
+ $return['gradelink'] = $gradelink->out(false);
+ }
+
+ return $return;
+ }
}
diff --git a/mod/assign/templates/submission_actionmenu.mustache b/mod/assign/templates/submission_actionmenu.mustache
index af806579a34..66c7b552cb6 100644
--- a/mod/assign/templates/submission_actionmenu.mustache
+++ b/mod/assign/templates/submission_actionmenu.mustache
@@ -37,8 +37,10 @@
+ {{#gradelink}}
+ {{/gradelink}}