Skip to content

Commit

Permalink
MDL-33766 files: Capability to ignore userquota
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Massart committed Nov 1, 2012
1 parent 21e3ea7 commit 380c122
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions lib/db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,15 @@
)
),

// Can the user ignore the setting userquota?
// The permissions are cloned from ignorefilesizelimits as it was partly used for that purpose.
'moodle/user:ignoreuserquota' => array(
'riskbitmap' => RISK_SPAM,
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'clonepermissionsfrom' => 'moodle/course:ignorefilesizelimits'
),

// can the user manage the system default dashboard page?
'moodle/my:configsyspages' => array(

Expand Down
7 changes: 6 additions & 1 deletion user/files.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,15 @@
$PAGE->set_pagelayout('mydashboard');
$PAGE->set_pagetype('user-files');

$maxareabytes = $CFG->userquota;
if (has_capability('moodle/user:ignoreuserquota', $context)) {
$maxareabytes = -1;
}

$data = new stdClass();
$data->returnurl = $returnurl;
$options = array('subdirs' => 1, 'maxbytes' => $CFG->userquota, 'maxfiles' => -1, 'accepted_types' => '*',
'areamaxbytes' => $CFG->userquota);
'areamaxbytes' => $maxareabytes);
file_prepare_standard_filemanager($data, 'files', $options, $context, 'user', 'private', 0);

$mform = new user_files_form(null, array('data'=>$data, 'options'=>$options));
Expand Down

0 comments on commit 380c122

Please sign in to comment.