MDL-17485 roles: fixed use and definition of review use of moodle/user:viewuseractivitiesreport

This commit is contained in:
skodak
2008-12-01 19:19:29 +00:00
parent 832e1528ad
commit 3c7da16d2d
5 changed files with 15 additions and 7 deletions
+4
View File
@@ -75,6 +75,10 @@
} else if ($course->showgrades and has_capability('moodle/grade:viewall', $personalcontext)) {
// ok - can view grades of this user - parent most probably
$modes[] = 'grade';
} else if ($course->showgrades and $anyreport) {
// ok - can view grades of this user - parent most probably
$modes[] = 'grade';
}
if (empty($modes)) {
+2 -3
View File
@@ -887,14 +887,13 @@ $moodle_capabilities = array(
)
),
// designed for parent role - not used in legacy roles
'moodle/user:viewuseractivitiesreport' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'legacy' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
+4 -3
View File
@@ -4640,7 +4640,9 @@ function print_user($user, $course, $messageselect=false, $return=false) {
$context = get_context_instance(CONTEXT_COURSE, $course->id);
if (isset($user->context->id)) {
$usercontext = get_context_instance_by_id($user->context->id);
$usercontext = $user->context;
} else {
$usercontext = get_context_instance(CONTEXT_USER, $user->id);
}
if (empty($string)) { // Cache all the strings for the rest of the page
@@ -4724,8 +4726,7 @@ has_capability('moodle/course:viewhiddenuserfields', $context)) {
$output .= '<a href="'.$CFG->wwwroot.'/notes/index.php?course=' . $course->id. '&amp;user='.$user->id.'">'.get_string('notes','notes').'</a><br />';
}
if (has_capability('moodle/user:viewuseractivitiesreport', $context) || (isset($usercontext) && has_capability('moodle/user:viewuseractivitiesreport', $usercontext))) {
$timemidnight = usergetmidnight(time());
if (has_capability('moodle/site:viewreports', $context) or has_capability('moodle/user:viewuseractivitiesreport', $usercontext)) {
$output .= '<a href="'. $CFG->wwwroot .'/course/user.php?id='. $course->id .'&amp;user='. $user->id .'">'. $string->activity .'</a><br />';
}
if (has_capability('moodle/role:assign', $context) and get_user_roles($context, $user->id, false)) { // I can unassing and user has some role
+4
View File
@@ -223,6 +223,10 @@
// ok - can view grades of this user - parent most probably
$gradeaccess = true;
} else if ($course->showgrades and $anyreport) {
// ok - can view grades of this user - parent most probably
$gradeaccess = true;
} else {
$gradeaccess = false;
}
+1 -1
View File
@@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
$version = 2008113001; // YYYYMMDD = date of the last version bump
$version = 2008120100; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20081128)'; // Human-friendly version name