Skip to content

Commit

Permalink
MDL-36141 course Define role to limit access to Other users.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmerrill committed Apr 4, 2014
1 parent 1a727e1 commit 288e7b0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion enrol/otherusers.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
$context = context_course::instance($course->id, MUST_EXIST);

require_login($course);
require_capability('moodle/role:assign', $context);
require_capability('moodle/course:reviewotherusers', $context);

if ($course->id == SITEID) {
redirect("$CFG->wwwroot/");
Expand Down
1 change: 1 addition & 0 deletions lang/en/role.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
$string['course:publish'] = 'Publish a course into hub';
$string['course:request'] = 'Request new courses';
$string['course:reset'] = 'Reset course';
$string['course:reviewotherusers'] = 'Review other users';
$string['course:sectionvisibility'] = 'Control section visibility';
$string['course:setcurrentsection'] = 'Set current section';
$string['course:update'] = 'Update course settings';
Expand Down
11 changes: 11 additions & 0 deletions lib/db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,17 @@
)
),

'moodle/course:reviewotherusers' => array(

'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW,
),
'clonepermissionsfrom' => 'moodle/role:assign'
),

'moodle/course:bulkmessaging' => array(

'riskbitmask' => RISK_SPAM,
Expand Down
2 changes: 1 addition & 1 deletion lib/enrollib.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ function enrol_add_course_navigation(navigation_node $coursenode, $course) {
// Deal somehow with users that are not enrolled but still got a role somehow
if ($course->id != SITEID) {
//TODO, create some new UI for role assignments at course level
if (has_capability('moodle/role:assign', $coursecontext)) {
if (has_capability('moodle/course:reviewotherusers', $coursecontext)) {
$url = new moodle_url('/enrol/otherusers.php', array('id'=>$course->id));
$usersnode->add(get_string('notenrolledusers', 'enrol'), $url, navigation_node::TYPE_SETTING, null, 'otherusers', new pix_icon('i/assignroles', ''));
}
Expand Down

0 comments on commit 288e7b0

Please sign in to comment.