MDL-14627 new mod/page:view capability
This commit is contained in:
@@ -27,6 +27,15 @@
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$capabilities = array(
|
||||
'mod/page:view' => array(
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_MODULE,
|
||||
'archetypes' => array(
|
||||
'guest' => CAP_ALLOW,
|
||||
'user' => CAP_ALLOW,
|
||||
)
|
||||
),
|
||||
|
||||
/* TODO: review public portfolio API first!
|
||||
'mod/page:portfolioexport' => array(
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ $string['modulename_help'] = 'A page enables a web page to be displayed and edit
|
||||
$string['modulenameplural'] = 'Pages';
|
||||
$string['neverseen'] = 'Never seen';
|
||||
$string['optionsheader'] = 'Options';
|
||||
$string['page:view'] = 'View page content';
|
||||
$string['pluginadministration'] = 'Page module administration';
|
||||
$string['pluginname'] = 'Page';
|
||||
$string['popupheight'] = 'Popup height (in pixels)';
|
||||
|
||||
@@ -351,6 +351,9 @@ function page_pluginfile($course, $cm, $context, $filearea, $args, $forcedownloa
|
||||
}
|
||||
|
||||
require_course_login($course, true, $cm);
|
||||
if (!has_capability('mod/page: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;
|
||||
|
||||
|
||||
@@ -48,6 +48,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/page:view', $context);
|
||||
|
||||
add_to_log($course->id, 'page', 'view', 'view.php?id='.$cm->id, $page->id, $cm->id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user