mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-58220 assign: Only show write access to teachers
In filebrowser api - this is also used by repositories using controlled links.
This commit is contained in:
parent
ffda3e395c
commit
6e0d700de8
1 changed files with 10 additions and 6 deletions
|
@ -582,6 +582,7 @@ abstract class assign_plugin {
|
||||||
$urlbase = $CFG->wwwroot.'/pluginfile.php';
|
$urlbase = $CFG->wwwroot.'/pluginfile.php';
|
||||||
$writeaccess = false;
|
$writeaccess = false;
|
||||||
// Permission check on the itemid.
|
// Permission check on the itemid.
|
||||||
|
$assignment = $this->assignment;
|
||||||
|
|
||||||
if ($this->get_subtype() == 'assignsubmission') {
|
if ($this->get_subtype() == 'assignsubmission') {
|
||||||
if ($itemid) {
|
if ($itemid) {
|
||||||
|
@ -590,16 +591,19 @@ abstract class assign_plugin {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!empty($record->userid)) {
|
if (!empty($record->userid)) {
|
||||||
if (!$this->assignment->can_view_submission($record->userid)) {
|
if (!$assignment->can_view_submission($record->userid)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$writeaccess = $this->assignment->can_edit_submission($record->userid);
|
|
||||||
|
// We only report write access for teachers.
|
||||||
|
$writeaccess = $assignment->can_grade() && $assignment->can_edit_submission($record->userid);
|
||||||
} else {
|
} else {
|
||||||
// Must be a team submission with a group.
|
// Must be a team submission with a group.
|
||||||
if (!$this->assignment->can_view_group_submission($record->groupid)) {
|
if (!$assignment->can_view_group_submission($record->groupid)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$writeaccess = $this->assignment->can_edit_group_submission($record->groupid);
|
// We only report write access for teachers.
|
||||||
|
$writeaccess = $assignment->can_grade() && $assignment->can_edit_group_submission($record->groupid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -610,7 +614,7 @@ abstract class assign_plugin {
|
||||||
$fs = get_file_storage();
|
$fs = get_file_storage();
|
||||||
$filepath = is_null($filepath) ? '/' : $filepath;
|
$filepath = is_null($filepath) ? '/' : $filepath;
|
||||||
$filename = is_null($filename) ? '.' : $filename;
|
$filename = is_null($filename) ? '.' : $filename;
|
||||||
if (!($storedfile = $fs->get_file($this->assignment->get_context()->id,
|
if (!($storedfile = $fs->get_file($assignment->get_context()->id,
|
||||||
$this->get_subtype() . '_' . $this->get_type(),
|
$this->get_subtype() . '_' . $this->get_type(),
|
||||||
$filearea,
|
$filearea,
|
||||||
$itemid,
|
$itemid,
|
||||||
|
@ -620,7 +624,7 @@ abstract class assign_plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
return new file_info_stored($browser,
|
return new file_info_stored($browser,
|
||||||
$this->assignment->get_context(),
|
$assignment->get_context(),
|
||||||
$storedfile,
|
$storedfile,
|
||||||
$urlbase,
|
$urlbase,
|
||||||
$filearea,
|
$filearea,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue