Some better security when database is hidden

This commit is contained in:
moodler
2006-03-30 04:37:16 +00:00
parent b9957ccb1d
commit 3d1c33ef01
4 changed files with 18 additions and 2 deletions
+7 -1
View File
@@ -56,14 +56,20 @@
}
require_course_login($course, false, $cm);
/// If it's hidden then it's don't show anything. :)
if (empty($cm->visible) and !isteacher($course->id)) {
notice(get_string("activityiscurrentlyhidden"));
}
/// Can't use this if there are no fields
if (isteacher($course->id)) {
if (!record_exists('data_fields','dataid',$data->id)) { // Brand new database!
redirect($CFG->wwwroot.'/mod/data/field.php?d='.$data->id); // Redirect to field entry
}
}
///checking for participants
/// Check access for participants
if ((!isteacher($course->id)) && $data->participants == DATA_TEACHERS_ONLY) {
error (get_string('noaccess','data'));
}
+2 -1
View File
@@ -25,7 +25,6 @@
require_once('../../config.php');
require_once('lib.php');
require_login();
$id = optional_param('id', 0, PARAM_INT); // course module id
$d = optional_param('d', 0, PARAM_INT); // database id
@@ -64,6 +63,8 @@
}
}
require_course_login($course, true, $cm);
if (!isteacheredit($course->id)){
error(get_string('noaccess','data'));
}
+2
View File
@@ -55,6 +55,8 @@
}
}
require_course_login($course, true, $cm);
if (!isteacheredit($course->id)){
error(get_string('noaccess','data'));
}
+7
View File
@@ -81,8 +81,15 @@
$record = NULL;
}
require_course_login($course, true, $cm);
/// If it's hidden then it's don't show anything. :)
if (empty($cm->visible) and !isteacher($course->id)) {
notice(get_string("activityiscurrentlyhidden"));
}
/// If we have an empty Database then redirect because this page is useless without data
if (isteacher($course->id)) {
if (!record_exists('data_fields','dataid',$data->id)) { // Brand new database!