Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.2.1
-
None
-
2016100402
-
MOODLE_32_STABLE
-
MOODLE_33_STABLE
Description
Hi!
I wanted to have my teachers not to be able to see the students emails on scheduler. While in Moodle you can set the permission to hide the emails, the plugin will not check those permissions also.
I did few improvements (at least for my case! ) by adding the following (Sorry it's not a working patch, because i had to remove few modifications that i made on those files also on the same commit :/) But it gives an idea about the changes made.
Thank you
— a/locallib.php
+++ b/locallib.php
@@ -117,12 +117,17 @@ function scheduler_print_user($user, $course, $messageselect=false, $return=fals
if (!empty($user->role) and ($user->role <> $course->teacher))
-
+//FIX permission
+if (has_capability('moodle/site:viewuseridentity', $context)) {
$extrafields = scheduler_get_user_fields($user);
+///Fix Permission we replaced the next line
+// $extrafields = scheduler_get_user_fields($user);
foreach ($extrafields as $field)
-
+//Fix Permission
+}else{$extrafields = scheduler_get_user_fields(null);}
+///Fix Permission
if (!isset($hiddenfields['lastaccess'])) {
if ($user->lastaccess) {
$output .= $string->lastaccess .': '. userdate($user->lastaccess);
diff --git a/teacherview.php b/teacherview.php
index 3095767..263650a 100644
— a/teacherview.php
+++ b/teacherview.php
@@ -545,7 +542,12 @@
new pix_icon('t/approve', '', 'moodle'),
get_string('markasseennow', 'scheduler') );
+//Fix Need to check if teacher has permission to get those userfields
+if (has_capability('moodle/site:viewuseridentity', $context))
else
{ $userfields = scheduler_get_user_fields(null); }+///Fix Comment the original line
+// $userfields = scheduler_get_user_fields($student);
$fieldvals = array();
foreach ($userfields as $f) {
$fieldvals[] = $f->value;
— a/exportlib.php
+++ b/exportlib.php
@@ -125,7 +125,7 @@ function scheduler_get_export_fields() {
$result[] = new scheduler_student_field('child', 'child', 25);
$result[] = new scheduler_student_field('studentfirstname', 'firstname');
$result[] = new scheduler_student_field('studentlastname', 'lastname');
-$result[] = new scheduler_student_field('studentemail', 'email');
+//Fix Commented missing Permissions $result[] = new scheduler_student_field('studentemail', 'email');
$result[] = new scheduler_student_field('studentusername', 'username');
$result[] = new scheduler_student_field('studentidnumber', 'idnumber');