]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-13107 - clean up data cvs import capability checks
authorpoltawski <poltawski>
Wed, 23 Jan 2008 13:27:47 +0000 (13:27 +0000)
committerpoltawski <poltawski>
Wed, 23 Jan 2008 13:27:47 +0000 (13:27 +0000)
Removed bad check 'mod/data:uploadentries' (which doesn't exist),
replaced it with mod/data:manageentries which is what is used to display
the form for this page.

Also removed the empty database redirect and editing entries checks
as there no way to get to this point in the UI and capability check
is covered by the manageentries requirecap (+ later sesskey check).

merged from MOODLE_19_STABLE

mod/data/import.php

index c3ac8c73e071be3143d5b2cc4273d3f9112a605b..f66faa9a52e1a43335149c9a49b41ff1d2b6440a 100755 (executable)
     require_login($course, false, $cm);
 
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-    require_capability('mod/data:uploadentries', $context);
-
-    if (has_capability('mod/data:managetemplates', $context)) {
-        if (!count_records('data_fields','dataid',$data->id)) {      // Brand new database!
-            redirect($CFG->wwwroot.'/mod/data/field.php?d='.$data->id);  // Redirect to field entry
-        }
-    }
-
-    if ($rid){    //editting a record, do you have access to edit this?
-        if (!has_capability('mod/data:manageentries', $context) or !data_isowner($rid) or !confirm_sesskey()){
-            error (get_string('noaccess','data'));
-        }
-    }
-
+    require_capability('mod/data:manageentries', $context);
 
 /// Print the page header
     $strdata = get_string('modulenameplural','data');