]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11451 grade publishing security/privacy improved - new capabilities needed for...
authorskodak <skodak>
Thu, 27 Sep 2007 06:51:54 +0000 (06:51 +0000)
committerskodak <skodak>
Thu, 27 Sep 2007 06:51:54 +0000 (06:51 +0000)
27 files changed:
grade/export/ods/db/access.php
grade/export/ods/dump.php
grade/export/ods/index.php
grade/export/ods/version.php
grade/export/txt/db/access.php
grade/export/txt/dump.php
grade/export/txt/index.php
grade/export/txt/version.php
grade/export/xls/db/access.php
grade/export/xls/dump.php
grade/export/xls/index.php
grade/export/xls/version.php
grade/export/xml/db/access.php
grade/export/xml/dump.php
grade/export/xml/index.php
grade/export/xml/version.php
grade/import/xml/db/access.php
grade/import/xml/fetch.php
grade/import/xml/index.php
grade/import/xml/version.php
lang/en_utf8/gradeexport_csv.php
lang/en_utf8/gradeexport_ods.php
lang/en_utf8/gradeexport_txt.php
lang/en_utf8/gradeexport_xls.php
lang/en_utf8/gradeexport_xml.php
lang/en_utf8/gradeimport_xml.php
lang/en_utf8/grades.php

index b7b6c2df09315d01c46e07090d12860f6d2111e8..8c2b7712b01c10250fb1874768e51ba20d259831 100644 (file)
@@ -11,7 +11,17 @@ $gradeexport_ods_capabilities = array(
             'editingteacher' => CAP_ALLOW,
             'admin' => CAP_ALLOW
         )
+    ),
+
+    'gradeexport/ods:publish' => array(
+        'riskbitmask' => RISK_PERSONAL,
+        'captype' => 'read',
+        'contextlevel' => CONTEXT_COURSE,
+        'legacy' => array(
+            'admin' => CAP_ALLOW
+        )
     )
+
 );
 
 ?>
index fb7c17ece840f1ed6093d9f6c4d16fb7ca6214ae..f1dd09b8122d9986c0959be9e20e4db435ac3fd0 100644 (file)
@@ -4,6 +4,9 @@ $nomoodlecookie = true; // session not used here
 require '../../../config.php';
 
 $id = required_param('id', PARAM_INT); // course id
+if (!$course = get_record('course', 'id', $id)) {
+    print_error('nocourseid');
+}
 
 require_user_key_login('grade/export', $id); // we want different keys for each course
 
@@ -11,6 +14,9 @@ if (empty($CFG->gradepublishing)) {
     error('Grade publishing disabled');
 }
 
+$context = get_context_instance(CONTEXT_COURSE, $id);
+require_capability('gradeexport/ods:pusblish', $context);
+
 // use the same page parameters as export.php and append &key=sdhakjsahdksahdkjsahksadjksahdkjsadhksa
 require 'export.php';
 
index c3d01ccba997b40bea8d4ccc4f5f0ccef51e3c47..36015d13c4e017c89895cdad43a23fb50750190a 100755 (executable)
@@ -47,6 +47,10 @@ $navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course-
 print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation);
 print_grade_plugin_selector($id, 'export', 'ods');
 
+if (!empty($CFG->gradepublishing)) {
+    $CFG->gradepublishing = has_capability('gradeexport/ods:publish', $context);
+}
+
 $mform = new grade_export_form(null, array('publishing' => true));
 
 // process post information
index 55d7451372e087ddba71095d31fdce8947ce89f5..c68c6e13e40a95ec0aa1f0c70d0770214e480763 100644 (file)
@@ -1,6 +1,6 @@
 <?PHP // $Id$
 
-$plugin->version  = 2007072500;
+$plugin->version  = 2007092701;
 $plugin->requires = 2007072402;
 
 ?>
index 243bd9b02701dd07523baa83d82d6ebb35bb3c89..5141e1aaa0f744b2b5ed9d6a2bedcfc78ef7c7c7 100644 (file)
@@ -11,7 +11,17 @@ $gradeexport_txt_capabilities = array(
             'editingteacher' => CAP_ALLOW,
             'admin' => CAP_ALLOW
         )
+    ),
+
+    'gradeexport/txt:publish' => array(
+        'riskbitmask' => RISK_PERSONAL,
+        'captype' => 'read',
+        'contextlevel' => CONTEXT_COURSE,
+        'legacy' => array(
+            'admin' => CAP_ALLOW
+        )
     )
+
 );
 
 ?>
index fb7c17ece840f1ed6093d9f6c4d16fb7ca6214ae..dd6be185f234f5f022d8e61a6bc0750ff9b47c4c 100644 (file)
@@ -4,6 +4,9 @@ $nomoodlecookie = true; // session not used here
 require '../../../config.php';
 
 $id = required_param('id', PARAM_INT); // course id
+if (!$course = get_record('course', 'id', $id)) {
+    print_error('nocourseid');
+}
 
 require_user_key_login('grade/export', $id); // we want different keys for each course
 
@@ -11,6 +14,9 @@ if (empty($CFG->gradepublishing)) {
     error('Grade publishing disabled');
 }
 
+$context = get_context_instance(CONTEXT_COURSE, $id);
+require_capability('gradeexport/txt:pusblish', $context);
+
 // use the same page parameters as export.php and append &key=sdhakjsahdksahdkjsahksadjksahdkjsadhksa
 require 'export.php';
 
index 56e287cdad2f9440ba158be8d777b58f85306a47..0f537d8dc82e983eaaaaaea0ae667a1de07a33bb 100755 (executable)
@@ -47,6 +47,10 @@ $navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course-
 print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation);
 print_grade_plugin_selector($id, 'export', 'txt');
 
+if (!empty($CFG->gradepublishing)) {
+    $CFG->gradepublishing = has_capability('gradeexport/txt:publish', $context);
+}
+
 $mform = new grade_export_form(null, array('includeseparator'=>true, 'publishing' => true));
 
 // process post information
index 55d7451372e087ddba71095d31fdce8947ce89f5..c8a85f377d9267f3a1ca12b4ec37b96cb63b635d 100755 (executable)
@@ -1,6 +1,6 @@
 <?PHP // $Id$
 
-$plugin->version  = 2007072500;
+$plugin->version  = 2007092700;
 $plugin->requires = 2007072402;
 
 ?>
index 6ea4d57c135c47336b294dee2311637908403fc9..eabce41c29a4ad3a3d532b23f2e0a102a7535eae 100644 (file)
@@ -11,7 +11,17 @@ $gradeexport_xls_capabilities = array(
             'editingteacher' => CAP_ALLOW,
             'admin' => CAP_ALLOW
         )
+    ),
+
+    'gradeexport/xls:publish' => array(
+        'riskbitmask' => RISK_PERSONAL,
+        'captype' => 'read',
+        'contextlevel' => CONTEXT_COURSE,
+        'legacy' => array(
+            'admin' => CAP_ALLOW
+        )
     )
+
 );
 
 ?>
index fb7c17ece840f1ed6093d9f6c4d16fb7ca6214ae..d2985d7421487bc70b9d50d98b127e811222c3de 100644 (file)
@@ -4,6 +4,9 @@ $nomoodlecookie = true; // session not used here
 require '../../../config.php';
 
 $id = required_param('id', PARAM_INT); // course id
+if (!$course = get_record('course', 'id', $id)) {
+    print_error('nocourseid');
+}
 
 require_user_key_login('grade/export', $id); // we want different keys for each course
 
@@ -11,6 +14,9 @@ if (empty($CFG->gradepublishing)) {
     error('Grade publishing disabled');
 }
 
+$context = get_context_instance(CONTEXT_COURSE, $id);
+require_capability('gradeexport/xls:pusblish', $context);
+
 // use the same page parameters as export.php and append &key=sdhakjsahdksahdkjsahksadjksahdkjsadhksa
 require 'export.php';
 
index edf8e1b704373e7637a6916abc236bc06cb79cc9..5c3803d3a9ba67fea3f7f246ecb41308134e1e0e 100755 (executable)
@@ -47,6 +47,10 @@ $navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course-
 print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation);
 print_grade_plugin_selector($id, 'export', 'xls');
 
+if (!empty($CFG->gradepublishing)) {
+    $CFG->gradepublishing = has_capability('gradeexport/xls:publish', $context);
+}
+
 $mform = new grade_export_form(null, array('publishing' => true));
 
 // process post information
index 55d7451372e087ddba71095d31fdce8947ce89f5..c8a85f377d9267f3a1ca12b4ec37b96cb63b635d 100644 (file)
@@ -1,6 +1,6 @@
 <?PHP // $Id$
 
-$plugin->version  = 2007072500;
+$plugin->version  = 2007092700;
 $plugin->requires = 2007072402;
 
 ?>
index 51233ab985f70b37ea4a930a27fcba6cd0cf1517..e95ce44b794085789cfec11a48e157d4fb1ccde9 100644 (file)
@@ -11,7 +11,17 @@ $gradeexport_xml_capabilities = array(
             'editingteacher' => CAP_ALLOW,
             'admin' => CAP_ALLOW
         )
+    ),
+
+    'gradeexport/xml:publish' => array(
+        'riskbitmask' => RISK_PERSONAL,
+        'captype' => 'read',
+        'contextlevel' => CONTEXT_COURSE,
+        'legacy' => array(
+            'admin' => CAP_ALLOW
+        )
     )
+
 );
 
 ?>
index fb7c17ece840f1ed6093d9f6c4d16fb7ca6214ae..198260a86e76d215881bf6a6b9a5b89f74d3868c 100644 (file)
@@ -4,6 +4,9 @@ $nomoodlecookie = true; // session not used here
 require '../../../config.php';
 
 $id = required_param('id', PARAM_INT); // course id
+if (!$course = get_record('course', 'id', $id)) {
+    print_error('nocourseid');
+}
 
 require_user_key_login('grade/export', $id); // we want different keys for each course
 
@@ -11,6 +14,9 @@ if (empty($CFG->gradepublishing)) {
     error('Grade publishing disabled');
 }
 
+$context = get_context_instance(CONTEXT_COURSE, $id);
+require_capability('gradeexport/xml:pusblish', $context);
+
 // use the same page parameters as export.php and append &key=sdhakjsahdksahdkjsahksadjksahdkjsadhksa
 require 'export.php';
 
index 245601fbb01524c6705d029c9199485a9a38b8ac..483e64ad50d2bbc6eb2bf23c126111752b1c7556 100755 (executable)
@@ -47,6 +47,10 @@ $navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course-
 print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation);
 print_grade_plugin_selector($id, 'export', 'xml');
 
+if (!empty($CFG->gradepublishing)) {
+    $CFG->gradepublishing = has_capability('gradeexport/xml:publish', $context);
+}
+
 $mform = new grade_export_form(null, array('idnumberrequired'=>true, 'publishing' => true));
 
 // process post information
index 55d7451372e087ddba71095d31fdce8947ce89f5..c8a85f377d9267f3a1ca12b4ec37b96cb63b635d 100644 (file)
@@ -1,6 +1,6 @@
 <?PHP // $Id$
 
-$plugin->version  = 2007072500;
+$plugin->version  = 2007092700;
 $plugin->requires = 2007072402;
 
 ?>
index c221c464523ae98fd7b7e391d2750b7876b09fb9..b4558d678cb3cb5e4a24982fc3e41baa124af086 100644 (file)
@@ -9,6 +9,14 @@ $gradeimport_xml_capabilities = array(
             'editingteacher' => CAP_ALLOW,
             'admin' => CAP_ALLOW
         )
+    ),
+
+    'gradeimport/xml:publish' => array(
+        'captype' => 'write',
+        'contextlevel' => CONTEXT_COURSE,
+        'legacy' => array(
+            'admin' => CAP_ALLOW
+        )
     )
 );
 
index 37a69bc533291ea14cd62ea025a3edc100e55e47..b04e27f23c7590a6573b6d5e3dafd26d6c3d00b4 100644 (file)
@@ -4,6 +4,9 @@ $nomoodlecookie = true; // session not used here
 require '../../../config.php';
 
 $id = required_param('id', PARAM_INT); // course id
+if (!$course = get_record('course', 'id', $id)) {
+    print_error('nocourseid');
+}
 
 require_user_key_login('grade/import', $id); // we want different keys for each course
 
@@ -11,6 +14,9 @@ if (empty($CFG->gradepublishing)) {
     error('Grade publishing disabled');
 }
 
+$context = get_context_instance(CONTEXT_COURSE, $id);
+require_capability('gradeimport/xml:pusblish', $context);
+
 // use the same page parameters as import.php and append &key=sdhakjsahdksahdkjsahksadjksahdkjsadhksa
 require 'import.php';
 
index 912eedfd8eb2c8836eef7d9d6ca8ebe22eb92d0f..1e4ea1e40ddf6fe6764d81f5d11215b7ccbf8513 100755 (executable)
@@ -43,6 +43,10 @@ $strgrades = get_string('grades', 'grades');
 $actionstr = get_string('modulename', 'gradeimport_xml');
 $navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course->id));
 
+if (!empty($CFG->gradepublishing)) {
+    $CFG->gradepublishing = has_capability('gradeimport/xml:publish', $context);
+}
+
 $mform = new grade_import_form();
 
 if ($data = $mform->get_data()) {
index d616882fb9bdb70049f32b0595115fb71e06435d..2aebb9ce74635bdcfccf62df15bc7a30e01d7d9b 100644 (file)
@@ -1,6 +1,6 @@
 <?PHP // $Id$
 
-$plugin->version  = 2007092600;
+$plugin->version  = 2007092700;
 $plugin->requires = 2007092002;
 
 ?>
index 216a15a0b81b66848f2669819bd875fb4deb8124..3ccf9a43ffb1824db08a082d9b1dddc8e759f9bb 100644 (file)
@@ -2,5 +2,6 @@
 
 $string['modulename'] = 'CSV file';
 $string['cvs:view'] = 'Use CSV grade export';
+$string['cvs:publish'] = 'Publish CSV grade export';
 
 ?>
index 90eee3b7820a54b54b640bd2bdee63d6f79ed283..b002037434c97f1f21eb20bf490abddc3f8cc535 100644 (file)
@@ -2,5 +2,6 @@
 
 $string['modulename'] = 'OpenOffice spreadsheet';
 $string['ods:view'] = 'Use Openoffice grade export';
+$string['ods:publish'] = 'Publish ODS grade export';
 
 ?>
index 242e2da8159c494339e38b76c2c98152107593de..45cd6dabff5791937394f272945a19fb9b503d90 100644 (file)
@@ -2,5 +2,6 @@
 
 $string['modulename'] = 'Plain text file';
 $string['txt:view'] = 'Use text grade export';
+$string['txt:publish'] = 'Publish TXT grade export';
 
 ?>
index 74d94749e099d010bd717f7ac34142d4fc9a740e..3a65e05fbc36e2d73091538a66cfb6057a78769f 100644 (file)
@@ -2,5 +2,6 @@
 
 $string['modulename'] = 'Excel spreadsheet';
 $string['xls:view'] = 'Use Excel grade export';
+$string['xls:publish'] = 'Publish XLS grade export';
 
 ?>
index 534da6198641754f4dc4a609814684a7b008dc6b..6d85861222e2203faf6125598d281f508dd92e52 100644 (file)
@@ -2,5 +2,6 @@
 
 $string['modulename'] = 'XML file';
 $string['xml:view'] = 'Use XML grade export';
+$string['xml:publish'] = 'Publish XML grade export';
 
 ?>
index 6b76b910eb9c0f2dc34ffee5c419a4741e3ea276..1cd932f1f0a9c83ade5a99545221d78db66d6e03 100644 (file)
@@ -6,5 +6,6 @@ $string['errincorrectidnumber'] = 'Error - incorrect idnumber';
 $string['fileurl'] = 'Remote file URL';
 $string['modulename'] = 'XML file';
 $string['xml:view'] = 'Import grades from XML';
+$string['xml:publish'] = 'Publish import grades from XML';
 
 ?>
index 6f053664ce3e81cda42b6cf974b875fd8b3b04d2..93caa384fbea3672fec87f306ba17873b1e9f184 100644 (file)
@@ -71,7 +71,7 @@ $string['configgradeboundary'] = 'A percentage boundary over which grades will b
 $string['configgradedisplaytype'] = 'Grades can be shown as real grades, as percentages (in reference to the minimum and maximum grades) or as letters (A, B, C etc..)';
 $string['configgradeletter'] = 'A letter or other symbol used to represent a range of grades.';
 $string['configgradeletterdefault'] = 'A letter or other symbol used to represent a range of grades. Leave this field empty to use the site default (currently $a).';
-$string['configgradepublishing'] = 'Enable publishing in exports and imports: Exported grades can be accessed by accessing a URL, without having to log on to a Moodle site. Grades can be imported by accessing such a URL (which means that a moodle site can import grades published by another site).';
+$string['configgradepublishing'] = 'Enable publishing in exports and imports: Exported grades can be accessed by accessing a URL, without having to log on to a Moodle site. Grades can be imported by accessing such a URL (which means that a moodle site can import grades published by another site). By default only administrators may use this feature, please educate users before adding required capabilities to other roles (dangers of bookmark sharing and download accelerators, IP restrictions, etc.).';
 $string['configmeanselection'] = 'Select which types of grades will be included in the column averages. Cells with no grade can be ignored, or counted as 0 (default setting).';
 $string['configquickfeedback'] = 'Quick Feedback adds a text input element in each grade cell on the grader report, allowing you to edit many grades at once. You can then click the Update button to perform all these changes at once, instead of one at a time.';
 $string['configquickgrading'] = 'Quick Grading adds a text input element in each grade cell on the grader report, allowing you to edit the feedback for many grades at once. You can then click the Update button to perform all these changes at once, instead of one at a time.';