mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-11511, revert the changes, see tracker
This commit is contained in:
parent
73b36bca84
commit
046dd7dcf6
5 changed files with 7 additions and 58 deletions
|
@ -165,31 +165,8 @@ $mod_data_capabilities = array(
|
||||||
'legacy' => array(
|
'legacy' => array(
|
||||||
'admin' => CAP_ALLOW
|
'admin' => CAP_ALLOW
|
||||||
)
|
)
|
||||||
),
|
)
|
||||||
|
|
||||||
'mod/data:editownentries' => array(
|
|
||||||
'riskbitmask' => RISK_SPAM,
|
|
||||||
|
|
||||||
'captype' => 'write',
|
|
||||||
'contextlevel' => CONTEXT_MODULE,
|
|
||||||
'legacy' => array(
|
|
||||||
'student' => CAP_ALLOW,
|
|
||||||
'teacher' => CAP_ALLOW,
|
|
||||||
'editingteacher' => CAP_ALLOW,
|
|
||||||
'admin' => CAP_ALLOW
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
'mod/data:deleteownentries' => array(
|
|
||||||
'captype' => 'read',
|
|
||||||
'contextlevel' => CONTEXT_MODULE,
|
|
||||||
'legacy' => array(
|
|
||||||
'student' => CAP_ALLOW,
|
|
||||||
'teacher' => CAP_ALLOW,
|
|
||||||
'editingteacher' => CAP_ALLOW,
|
|
||||||
'admin' => CAP_ALLOW
|
|
||||||
)
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -81,14 +81,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($rid) { // So do you have access?
|
if ($rid) { // So do you have access?
|
||||||
if (!confirm_sesskey()) {
|
if (!(has_capability('mod/data:manageentries', $context) or data_isowner($rid)) or !confirm_sesskey() ) {
|
||||||
print_error('confirmsesskeybad', 'error');
|
print_error('noaccess','data');
|
||||||
}
|
|
||||||
|
|
||||||
if (data_isowner($rid)){
|
|
||||||
require_capability('mod/data:editownentries', $context);
|
|
||||||
}else{
|
|
||||||
require_capability('mod/data:manageentries', $context);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -954,25 +954,14 @@ function data_print_template($template, $records, $data, $search='',$page=0, $re
|
||||||
/// Replacing special tags (##Edit##, ##Delete##, ##More##)
|
/// Replacing special tags (##Edit##, ##Delete##, ##More##)
|
||||||
$patterns[]='##edit##';
|
$patterns[]='##edit##';
|
||||||
$patterns[]='##delete##';
|
$patterns[]='##delete##';
|
||||||
$isteacher = has_capability('mod/data:manageentries', $context);
|
if (has_capability('mod/data:manageentries', $context) or data_isowner($record->id)) {
|
||||||
$isowner = data_isowner($record->id);
|
|
||||||
$canedit = $isteacher or ($isowner && has_capability('mod/data:editownentries', $context));
|
|
||||||
$candelete = $isteacher or ($isowner && has_capability('mod/data:deleteownentries', $context));
|
|
||||||
|
|
||||||
if ($canedit) {
|
|
||||||
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/edit.php?d='
|
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/edit.php?d='
|
||||||
.$data->id.'&rid='.$record->id.'&sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'.get_string('edit').'" title="'.get_string('edit').'" /></a>';
|
.$data->id.'&rid='.$record->id.'&sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'.get_string('edit').'" title="'.get_string('edit').'" /></a>';
|
||||||
}else{
|
|
||||||
$replacement[] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if($candelete) {
|
|
||||||
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/view.php?d='
|
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/view.php?d='
|
||||||
.$data->id.'&delete='.$record->id.'&sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/delete.gif" class="iconsmall" alt="'.get_string('delete').'" title="'.get_string('delete').'" /></a>';
|
.$data->id.'&delete='.$record->id.'&sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/delete.gif" class="iconsmall" alt="'.get_string('delete').'" title="'.get_string('delete').'" /></a>';
|
||||||
}else{
|
} else {
|
||||||
$replacement[] = '';
|
$replacement[] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$patterns[]='##more##';
|
$patterns[]='##more##';
|
||||||
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&rid='.$record->id.'"><img src="'.$CFG->pixpath.'/i/search.gif" class="iconsmall" alt="'.get_string('more', 'data').'" title="'.get_string('more', 'data').'" /></a>';
|
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&rid='.$record->id.'"><img src="'.$CFG->pixpath.'/i/search.gif" class="iconsmall" alt="'.get_string('more', 'data').'" title="'.get_string('more', 'data').'" /></a>';
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
// This fragment is called by /admin/index.php
|
// This fragment is called by /admin/index.php
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
$module->version = 2007101510;
|
$module->version = 2007101511;
|
||||||
$module->requires = 2007101509; // Requires this Moodle version
|
$module->requires = 2007101509; // Requires this Moodle version
|
||||||
$module->cron = 60;
|
$module->cron = 60;
|
||||||
|
|
||||||
|
|
|
@ -305,18 +305,7 @@
|
||||||
|
|
||||||
/// Delete any requested records
|
/// Delete any requested records
|
||||||
|
|
||||||
if ($delete){
|
if ($delete && confirm_sesskey() && (has_capability('mod/data:manageentries', $context) or data_isowner($delete))) {
|
||||||
|
|
||||||
if (!confirm_sesskey()) {
|
|
||||||
print_error('confirmsesskeybad', 'error');
|
|
||||||
}
|
|
||||||
|
|
||||||
if(data_isowner($delete)){
|
|
||||||
require_capability('mod/data:deleteownentries', $context);
|
|
||||||
}else{
|
|
||||||
require_capability('mod/data:manageentries', $context);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($confirm = optional_param('confirm',0,PARAM_INT)) {
|
if ($confirm = optional_param('confirm',0,PARAM_INT)) {
|
||||||
if ($deleterecord = get_record('data_records', 'id', $delete)) { // Need to check this is valid
|
if ($deleterecord = get_record('data_records', 'id', $delete)) { // Need to check this is valid
|
||||||
if ($deleterecord->dataid == $data->id) { // Must be from this database
|
if ($deleterecord->dataid == $data->id) { // Must be from this database
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue