From: vyshane Date: Mon, 18 Sep 2006 09:02:12 +0000 (+0000) Subject: Added moodle/site:viewparticipants X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=840c1c31fab0d54cf6700d565e590a19a6b4d56e;p=moodle.git Added moodle/site:viewparticipants --- diff --git a/blocks/participants/block_participants.php b/blocks/participants/block_participants.php index ed06386d38..a16b1def7c 100644 --- a/blocks/participants/block_participants.php +++ b/blocks/participants/block_participants.php @@ -15,16 +15,17 @@ class block_participants extends block_list { return ''; } - $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); // only 2 possible contexts, site or course if ($this->instance->pageid == SITEID) { // site context - $currentcontext = $sitecontext; + $currentcontext = get_context_instance(CONTEXT_SYSTEM, SITEID); + $canviewparticipants = has_capability('moodle/site:viewparticipants', $currentcontext); } else { // course context $currentcontext = get_context_instance(CONTEXT_COURSE, $this->instance->pageid); + $canviewparticipants = has_capability('moodle/course:viewparticipants', $currentcontext); } - if (!has_capability('moodle/course:viewparticipants', $currentcontext)) { + if (!$canviewparticipants) { $this->context = ''; return $this->content; } @@ -48,7 +49,7 @@ class block_participants extends block_list { } if ($this->instance->pageid != SITEID - || has_capability('moodle/course:viewparticipants', $sitecontext)) { + || $canviewparticipants) { $this->content->items[] = ''.get_string('participants').''; diff --git a/lib/db/access.php b/lib/db/access.php index 6975043f94..1dd45d9081 100644 --- a/lib/db/access.php +++ b/lib/db/access.php @@ -199,6 +199,20 @@ $moodle_capabilities = array( 'admin' => CAP_ALLOW ) ), + + 'moodle/site:viewparticipants' => array( + + 'captype' => 'read', + 'contextlevel' => CONTEXT_SYSTEM, + 'legacy' => array( + 'guest' => CAP_PREVENT, + 'student' => CAP_PREVENT, + 'teacher' => CAP_PREVENT, + 'editingteacher' => CAP_ALLOW, + 'coursecreator' => CAP_ALLOW, + 'admin' => CAP_ALLOW + ) + ), 'moodle/site:viewreports' => array(