mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
MDL-14627 new mod/folder:view capability
This commit is contained in:
parent
848fe203df
commit
9093de6354
@ -27,6 +27,15 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$capabilities = array(
|
||||
'mod/folder:view' => array(
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_MODULE,
|
||||
'archetypes' => array(
|
||||
'guest' => CAP_ALLOW,
|
||||
'user' => CAP_ALLOW,
|
||||
)
|
||||
),
|
||||
|
||||
/* TODO: review public portfolio API first!
|
||||
'mod/folder:portfolioexport' => array(
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
$string['contentheader'] = 'Content';
|
||||
$string['folder:managefiles'] = 'Manage files in folder module';
|
||||
$string['folder:view'] = 'View folder content';
|
||||
$string['foldercontent'] = 'Files and subfolders';
|
||||
$string['modulename'] = 'Folder';
|
||||
$string['modulenameplural'] = 'Folders';
|
||||
|
@ -289,6 +289,9 @@ function folder_pluginfile($course, $cm, $context, $filearea, $args, $forcedownl
|
||||
}
|
||||
|
||||
require_course_login($course, true, $cm);
|
||||
if (!has_capability('mod/folder:view', $context)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filearea !== 'content') {
|
||||
// intro is handled automatically in pluginfile.php
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$module->version = 2010080300;
|
||||
$module->version = 2010101400;
|
||||
$module->requires = 2010080300; // Requires this Moodle version
|
||||
$module->cron = 0;
|
||||
|
||||
|
@ -45,6 +45,7 @@ $course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);
|
||||
|
||||
require_course_login($course, true, $cm);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('mod/folder:view', $context);
|
||||
|
||||
add_to_log($course->id, 'folder', 'view', 'view.php?id='.$cm->id, $folder->id, $cm->id);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user