[MDL-8407] Make the default role required to export database records weaker (use the 1.9 mod/data capability "viewalluserpresets").

This commit is contained in:
robertall
2008-06-12 13:49:40 +00:00
parent 7b8c3081a0
commit 258730666e
3 changed files with 41 additions and 202 deletions
+2 -3
View File
@@ -30,7 +30,7 @@ if (! $context = get_context_instance(CONTEXT_MODULE, $cm->id)) {
}
require_login($course->id, false, $cm);
require_capability('mod/data:managetemplates', $context);
require_capability(DATA_CAP_EXPORT, $context);
// get fields for this database
$fieldrecords = get_records('data_fields','dataid', $data->id, 'id');
@@ -67,7 +67,6 @@ if($mform->is_cancelled()) {
$groupmode = groups_get_activity_groupmode($cm);
$currenttab = 'export';
include('tabs.php');
$mform->display();
print_footer();
die;
@@ -80,7 +79,7 @@ foreach($fields as $key => $field) {
if(empty($formdata['field_'.$field->field->id])) {
// ignore values we aren't exporting
unset($fields[$key]);
} else{
} else {
$exportdata[0][] = $field->field->name;
}
}
+33 -197
View File
File diff suppressed because it is too large Load Diff
+6 -2
View File
@@ -53,6 +53,12 @@
$addstring = empty($editentry) ? get_string('add', 'data') : get_string('editentry', 'data');
$row[] = new tabobject('add', $CFG->wwwroot.'/mod/data/edit.php?d='.$data->id, $addstring);
}
if (has_capability(DATA_CAP_EXPORT, $context)) {
// The capability required to Export database records is centrally defined in 'lib.php'
// and should be weaker than those required to edit Templates, Fields and Presets.
$row[] = new tabobject('export', $CFG->wwwroot.'/mod/data/export.php?d='.$data->id,
get_string('export', 'data'));
}
if (has_capability('mod/data:managetemplates', $context)) {
if ($currenttab == 'list') {
$defaultemplate = 'listtemplate';
@@ -70,8 +76,6 @@
get_string('fields','data'));
$row[] = new tabobject('presets', $CFG->wwwroot.'/mod/data/preset.php?d='.$data->id,
get_string('presets', 'data'));
$row[] = new tabobject('export', $CFG->wwwroot.'/mod/data/export.php?d='.$data->id,
get_string('export', 'data'));
}
}