mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-14627 new mod/imscp:view capability
This commit is contained in:
parent
9093de6354
commit
e0334eca6f
@ -27,6 +27,14 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$capabilities = array(
|
||||
'mod/imscp:view' => array(
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_MODULE,
|
||||
'archetypes' => array(
|
||||
'guest' => CAP_ALLOW,
|
||||
'user' => CAP_ALLOW,
|
||||
)
|
||||
),
|
||||
|
||||
/* TODO: review public portfolio API first!
|
||||
'mod/imscp:portfolioexport' => array(
|
||||
|
@ -30,6 +30,7 @@ $string['contentheader'] = 'Content';
|
||||
$string['deploymenterror'] = 'Content package error!';
|
||||
$string['keepold'] = 'Archive packages';
|
||||
$string['keepoldexplain'] = 'How many packages should be archived?';
|
||||
$string['imscp:view'] = 'View IMS Content';
|
||||
$string['modulename'] = 'IMS content package';
|
||||
$string['modulename_help'] = 'An IMS content package allows for packages created according to the IMS Content Packaging specification to be displayed in the course.';
|
||||
$string['modulenameplural'] = 'IMS content packages';
|
||||
|
@ -338,6 +338,9 @@ function imscp_pluginfile($course, $cm, $context, $filearea, $args, $forcedownlo
|
||||
require_login($course, true, $cm);
|
||||
|
||||
if ($filearea === 'content') {
|
||||
if (!has_capability('mod/imscp:view', $context)) {
|
||||
return false;
|
||||
}
|
||||
$revision = array_shift($args);
|
||||
$fs = get_file_storage();
|
||||
$relativepath = implode('/', $args);
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$module->version = 2010080300;
|
||||
$module->version = 2010101400;
|
||||
$module->requires = 2010080300; // Requires this Moodle version
|
||||
$module->cron = 0;
|
||||
|
||||
|
@ -44,6 +44,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/imscp:view', $context);
|
||||
|
||||
add_to_log($course->id, 'imscp', 'view', 'view.php?id='.$cm->id, $imscp->id, $cm->id);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user