]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15768 - add new capabilities to mod/data for portfolio export
authormjollnir_ <mjollnir_>
Mon, 11 Aug 2008 13:45:41 +0000 (13:45 +0000)
committermjollnir_ <mjollnir_>
Mon, 11 Aug 2008 13:45:41 +0000 (13:45 +0000)
lang/en_utf8/data.php
mod/data/db/access.php
mod/data/lib.php
mod/data/version.php

index af97d5943d3661f32de231ac118320bc796eb60d..5fac4e6ad99ea3d959992f9befd05138ed6173f3 100644 (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';
index 71444b3e61b479d2503ce8989d4cfe787d91e044..69f8d04877a64a4d94786313300ca57138f27534 100644 (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,
+        )
+    ),
 );
 
 ?>
index dcc071e70286da9d07105cd52c91bcbea69f2c7e..4042f3093d38e9dee0a7bfd99dcf88de3324fd00 100755 (executable)
@@ -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() {
index 32d027c0be8e7660d44ed9bb8d42d6d9e55ad8b3..1eedf9b8dbbdd0fa5b67a665a52a858674916949 100644 (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;