MDL-15768 - add new capabilities to mod/data for portfolio export

This commit is contained in:
mjollnir_ 2008-08-11 13:45:41 +00:00
parent 7e51bbcee9
commit 07028cd91f
4 changed files with 43 additions and 4 deletions

View File

@ -54,6 +54,9 @@ $string['csvwithselecteddelimiter'] = '<acronym title=\"Comma Separated Values\"
$string['csvimport'] = 'CSV file import';
$string['data:approve'] = 'Approve unapproved entries';
$string['data:comment'] = 'Write comments';
$string['data:exportentry'] = 'Export a database entry';
$string['data:exportownentry'] = 'Export own database entry';
$string['data:exportallentries'] = 'Export all database entries';
$string['data:managecomments'] = 'Manage comments';
$string['data:manageentries'] = 'Manage entries';
$string['data:managetemplates'] = 'Manage templates';

View File

@ -165,8 +165,45 @@ $mod_data_capabilities = array(
'legacy' => array(
'admin' => CAP_ALLOW
)
)
),
'mod/data:exportentry' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'legacy' => array(
'admin' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
)
),
'mod/data:exportownentry' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'legacy' => array(
'admin' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'student' => CAP_ALLOW,
)
),
'mod/data:exportallentries' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'legacy' => array(
'admin' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
)
),
);
?>

View File

@ -2478,8 +2478,7 @@ class data_portfolio_caller extends portfolio_module_caller_base {
}
public function check_permissions() {
// @todo
return true;
return has_capability('mod/data:exportallentries', get_context_instance(CONTEXT_MODULE, $this->cm->id));
}
public static function display_name() {

View File

@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2007101513;
$module->version = 2007101514;
$module->requires = 2007101509; // Requires this Moodle version
$module->cron = 60;