MDL-13107 - clean up data cvs import capability checks

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
This commit is contained in:
poltawski 2008-01-23 13:27:47 +00:00
parent 6b4671097b
commit ab496ca8e5

View File

@ -60,20 +60,7 @@
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');