mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
MDL-71440 mod_assign: New capability for viewing the submission summary
Creates a new capability mod/assign:viewownsubmissionsummary which will be required in order to display the submission summary to the user in the assignment page.
This commit is contained in:
parent
a5f0b354e7
commit
1fa872b84f
@ -198,5 +198,13 @@ $capabilities = array(
|
||||
'manager' => CAP_ALLOW
|
||||
)
|
||||
),
|
||||
|
||||
'mod/assign:viewownsubmissionsummary' => array(
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_MODULE,
|
||||
'archetypes' => array(
|
||||
'student' => CAP_ALLOW
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -2375,8 +2375,8 @@ class mod_assign_external extends external_api {
|
||||
}
|
||||
|
||||
// Retrieve the rest of the renderable objects.
|
||||
$cansubmit = has_capability('mod/assign:submit', $context, $user, false);
|
||||
if ($cansubmit || $assign->get_user_submission($user->id, false) !== false) {
|
||||
if (has_capability('mod/assign:viewownsubmissionsummary', $context, $user, false)) {
|
||||
// The user can view the submission summary.
|
||||
$lastattempt = $assign->get_assign_submission_status_renderable($user, true);
|
||||
}
|
||||
|
||||
@ -2432,8 +2432,8 @@ class mod_assign_external extends external_api {
|
||||
}
|
||||
|
||||
// Can edit its own submission?
|
||||
$lastattempt->caneditowner = $cansubmit && $assign->submissions_open($user->id)
|
||||
&& $assign->is_any_submission_plugin_enabled();
|
||||
$lastattempt->caneditowner = has_capability('mod/assign:submit', $context, $user, false)
|
||||
&& $assign->submissions_open($user->id) && $assign->is_any_submission_plugin_enabled();
|
||||
|
||||
$result['lastattempt'] = $lastattempt;
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ $string['assign:viewgrades'] = 'View grades';
|
||||
$string['assign:showhiddengrader'] = 'See the identity of a hidden grader';
|
||||
$string['assign:submit'] = 'Submit assignment';
|
||||
$string['assign:view'] = 'View assignment';
|
||||
$string['assign:viewownsubmissionsummary'] = 'View own submission summary';
|
||||
$string['assignfeedback'] = 'Feedback plugin';
|
||||
$string['assignfeedbackpluginname'] = 'Feedback plugin';
|
||||
$string['assignmentisdue'] = 'Assignment is due';
|
||||
|
@ -5490,9 +5490,8 @@ class assign {
|
||||
$o = '';
|
||||
|
||||
if ($this->can_view_submission($user->id)) {
|
||||
$cansubmit = has_capability('mod/assign:submit', $this->get_context(), $user, false);
|
||||
if ($cansubmit || $this->get_user_submission($user->id, false) !== false) {
|
||||
// The user can submit, or has a submission.
|
||||
if (has_capability('mod/assign:viewownsubmissionsummary', $this->get_context(), $user, false)) {
|
||||
// The user can view the submission summary.
|
||||
$submissionstatus = $this->get_assign_submission_status_renderable($user, $showlinks);
|
||||
$o .= $this->get_renderer()->render($submissionstatus);
|
||||
}
|
||||
|
@ -25,5 +25,5 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->component = 'mod_assign'; // Full name of the plugin (used for diagnostics).
|
||||
$plugin->version = 2021052501; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2021052502; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2021052500; // Requires this Moodle version.
|
||||
|
Loading…
x
Reference in New Issue
Block a user