mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
MDL-60590 enrol_manual: only show cohorts with necessary capabilities
This commit is contained in:
parent
159b4e5d8c
commit
1bd70073c5
@ -102,8 +102,11 @@ class enrol_manual_enrol_users_form extends moodleform {
|
||||
);
|
||||
$mform->addElement('autocomplete', 'userlist', get_string('selectusers', 'enrol_manual'), array(), $options);
|
||||
|
||||
$options = ['contextid' => $context->id, 'multiple' => true];
|
||||
$mform->addElement('cohort', 'cohortlist', get_string('selectcohorts', 'enrol_manual'), $options);
|
||||
// Confirm the user can search for cohorts before displaying select.
|
||||
if (has_capability('moodle/cohort:manage', $context) || has_capability('moodle/cohort:view', $context)) {
|
||||
$options = ['contextid' => $context->id, 'multiple' => true];
|
||||
$mform->addElement('cohort', 'cohortlist', get_string('selectcohorts', 'enrol_manual'), $options);
|
||||
}
|
||||
|
||||
$roles = get_assignable_roles($context);
|
||||
$mform->addElement('select', 'roletoassign', get_string('assignrole', 'enrol_manual'), $roles);
|
||||
|
Loading…
x
Reference in New Issue
Block a user