From 07028cd91f0a66712590f80dae60749633696a28 Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Mon, 11 Aug 2008 13:45:41 +0000 Subject: [PATCH] MDL-15768 - add new capabilities to mod/data for portfolio export --- lang/en_utf8/data.php | 3 +++ mod/data/db/access.php | 39 ++++++++++++++++++++++++++++++++++++++- mod/data/lib.php | 3 +-- mod/data/version.php | 2 +- 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/lang/en_utf8/data.php b/lang/en_utf8/data.php index af97d5943d..5fac4e6ad9 100644 --- a/lang/en_utf8/data.php +++ b/lang/en_utf8/data.php @@ -54,6 +54,9 @@ $string['csvwithselecteddelimiter'] = ' 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, + ) + ), ); ?> diff --git a/mod/data/lib.php b/mod/data/lib.php index dcc071e702..4042f3093d 100755 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -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() { diff --git a/mod/data/version.php b/mod/data/version.php index 32d027c0be..1eedf9b8db 100644 --- a/mod/data/version.php +++ b/mod/data/version.php @@ -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; -- 2.39.5