From b09e0ba6c413c2d45251f4be4b3e04fda6a76df4 Mon Sep 17 00:00:00 2001 From: Juan Leyva Date: Fri, 10 Apr 2015 10:21:01 +0200 Subject: [PATCH] MDL-49426 webservices: Allow upload to draft area always --- webservice/upload.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webservice/upload.php b/webservice/upload.php index 03503b274db..619bb37e4bb 100644 --- a/webservice/upload.php +++ b/webservice/upload.php @@ -66,7 +66,12 @@ if ($fileuploaddisabled) { // check the user can manage his own files (can upload) $context = context_user::instance($USER->id); -require_capability('moodle/user:manageownfiles', $context); + +// Allow allways to upload files to the draft area, no matter if the user can't manage his own files. +// Files required by other webservices (like mod_assign ones) must be uploaded to the draft area. +if ($filearea === 'private') { + require_capability('moodle/user:manageownfiles', $context); +} if ($filearea !== 'private' and $filearea !== 'draft') { // Do not dare to allow more areas here!