Merge branch 'MDL-26061-no_remote_users' of git://github.com/mudrd8mz/moodle.git with changes
This commit is contained in:
@@ -40,6 +40,14 @@ if (!$service->is_available()) {
|
||||
die();
|
||||
}
|
||||
|
||||
$roamingusers = get_users_by_capability(get_system_context(), 'moodle/site:mnetlogintoremote', 'u.id');
|
||||
if (empty($roamingusers)) {
|
||||
$capname = get_string('site:mnetlogintoremote', 'role');
|
||||
$url = new moodle_url('/admin/roles/manage.php');
|
||||
echo notice(get_string('noroamingusers', 'mnetservice_enrol', $capname), $url);
|
||||
}
|
||||
unset($roamingusers);
|
||||
|
||||
// remote hosts that may publish remote enrolment service and we are subscribed to it
|
||||
$hosts = $service->get_remote_publishers();
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ $string['hostappname'] = 'Application';
|
||||
$string['hostname'] = 'Host name';
|
||||
$string['hosturl'] = 'Remote host URL';
|
||||
$string['nopublishers'] = 'No remote peers available.';
|
||||
$string['noroamingusers'] = 'Users require the capability \'{$a}\' in the system context to be enrolled to remote courses, however there are currently no users with this capability. Click the continue button to assign the required capability to one or more roles on your site.';
|
||||
$string['otherenrolledusers'] = 'Other enrolled users';
|
||||
$string['pluginname'] = 'Remote enrolment service';
|
||||
$string['refetch'] = 'Re-fetch up to date state from remote hosts';
|
||||
|
||||
@@ -552,6 +552,10 @@ class mnetservice_enrol_potential_users_selector extends user_selector_base {
|
||||
$systemcontext = get_system_context();
|
||||
$userids = get_users_by_capability($systemcontext, 'moodle/site:mnetlogintoremote', 'u.id');
|
||||
|
||||
if (empty($userids)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
list($usql, $uparams) = $DB->get_in_or_equal(array_keys($userids), SQL_PARAMS_NAMED, 'uid0000');
|
||||
|
||||
list($wherecondition, $params) = $this->search_sql($search, 'u');
|
||||
|
||||
Reference in New Issue
Block a user