From b96e85feacad1147cef5b80cfc6b2da94ba4775b Mon Sep 17 00:00:00 2001 From: Jake Dallimore Date: Thu, 20 Aug 2020 12:35:29 +0800 Subject: [PATCH] MDL-69510 admin: make ldap configuration warnings clear --- auth/cas/settings.php | 4 +++- auth/ldap/lang/en/auth_ldap.php | 2 +- auth/ldap/settings.php | 4 +++- enrol/ldap/lang/en/enrol_ldap.php | 2 +- enrol/ldap/settings.php | 11 +++++++---- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/auth/cas/settings.php b/auth/cas/settings.php index 5434984b0c2..aed941cb703 100644 --- a/auth/cas/settings.php +++ b/auth/cas/settings.php @@ -27,7 +27,9 @@ defined('MOODLE_INTERNAL') || die; if ($ADMIN->fulltree) { if (!function_exists('ldap_connect')) { - $settings->add(new admin_setting_heading('auth_casnotinstalled', '', get_string('auth_casnotinstalled', 'auth_cas'))); + $notify = new \core\output\notification(get_string('auth_casnotinstalled', 'auth_cas'), + \core\output\notification::NOTIFY_WARNING); + $settings->add(new admin_setting_heading('auth_casnotinstalled', '', $OUTPUT->render($notify))); } else { // We use a couple of custom admin settings since we need to massage the data before it is inserted into the DB. require_once($CFG->dirroot.'/auth/ldap/classes/admin_setting_special_lowercase_configtext.php'); diff --git a/auth/ldap/lang/en/auth_ldap.php b/auth/ldap/lang/en/auth_ldap.php index da0f7e9546c..46d846d0b22 100644 --- a/auth/ldap/lang/en/auth_ldap.php +++ b/auth/ldap/lang/en/auth_ldap.php @@ -62,7 +62,7 @@ $string['auth_ldap_memberattribute_isdn_key'] = 'Member attribute uses dn'; $string['auth_ldap_memberattribute_key'] = 'Member attribute'; $string['auth_ldap_noconnect'] = 'LDAP-module cannot connect to server: {$a}'; $string['auth_ldap_noconnect_all'] = 'LDAP-module cannot connect to any servers: {$a}'; -$string['auth_ldap_noextension'] = 'The PHP LDAP module does not seem to be present. Please ensure it is installed and enabled if you want to use this authentication plugin.'; +$string['auth_ldap_noextension'] = 'The PHP LDAP module does not seem to be present. Please ensure it is installed and enabled if you want to use this authentication plugin.'; $string['auth_ldap_no_mbstring'] = 'You need the mbstring extension to create users in Active Directory.'; $string['auth_ldapnotinstalled'] = 'Cannot use LDAP authentication. The PHP LDAP module is not installed.'; $string['auth_ldap_objectclass'] = 'Optional: Overrides objectClass used to name/search users on ldap_user_type. Usually you don\'t need to change this.'; diff --git a/auth/ldap/settings.php b/auth/ldap/settings.php index f9bc8d9b8f3..e5aa9c85b2d 100644 --- a/auth/ldap/settings.php +++ b/auth/ldap/settings.php @@ -27,7 +27,9 @@ defined('MOODLE_INTERNAL') || die; if ($ADMIN->fulltree) { if (!function_exists('ldap_connect')) { - $settings->add(new admin_setting_heading('auth_ldap_noextension', '', get_string('auth_ldap_noextension', 'auth_ldap'))); + $notify = new \core\output\notification(get_string('auth_ldap_noextension', 'auth_ldap'), + \core\output\notification::NOTIFY_WARNING); + $settings->add(new admin_setting_heading('auth_ldap_noextension', '', $OUTPUT->render($notify))); } else { // We use a couple of custom admin settings since we need to massage the data before it is inserted into the DB. diff --git a/enrol/ldap/lang/en/enrol_ldap.php b/enrol/ldap/lang/en/enrol_ldap.php index 3066945cd0d..83e88ec9496 100644 --- a/enrol/ldap/lang/en/enrol_ldap.php +++ b/enrol/ldap/lang/en/enrol_ldap.php @@ -99,7 +99,7 @@ $string['objectclass_key'] = 'Object class'; $string['ok'] = "OK!\n"; $string['opt_deref'] = 'If the group membership contains distinguished names, specify how aliases are handled during a search. Select one of the following values: \'No\' (LDAP_DEREF_NEVER) or \'Yes\' (LDAP_DEREF_ALWAYS).'; $string['opt_deref_key'] = 'Dereference aliases'; -$string['phpldap_noextension'] = 'The PHP LDAP module does not seem to be present. Please ensure it is installed and enabled if you want to use this enrolment plugin.'; +$string['phpldap_noextension'] = 'The PHP LDAP module does not seem to be present. Please ensure it is installed and enabled if you want to use this enrolment plugin.'; $string['pluginname'] = 'LDAP enrolments'; $string['pluginname_desc'] = '

You can use an LDAP server to control your enrolments. It is assumed your LDAP tree contains groups that map to the courses, and that each of those groups/courses will have membership entries to map to students.

It is assumed that courses are defined as groups in LDAP, with each group having multiple membership fields (member or memberUid) that contain a uniqueidentification of the user.

To use LDAP enrolment, your users must to have a valid idnumber field. The LDAP groups must have that idnumber in the member fields for a user to be enrolled in the course. This will usually work well if you are already using LDAP Authentication.

Enrolments will be updated when the user logs in. You can also run a script to keep enrolments in synch. Look in enrol/ldap/cli/sync.php.

This plugin can also be set to automatically create new courses when new groups appear in LDAP.

'; $string['pluginnotenabled'] = 'Plugin not enabled!'; diff --git a/enrol/ldap/settings.php b/enrol/ldap/settings.php index 2b668a5a997..c577859b7ae 100644 --- a/enrol/ldap/settings.php +++ b/enrol/ldap/settings.php @@ -27,12 +27,15 @@ defined('MOODLE_INTERNAL') || die(); if ($ADMIN->fulltree) { - //--- heading --- - $settings->add(new admin_setting_heading('enrol_ldap_settings', '', get_string('pluginname_desc', 'enrol_ldap'))); - if (!function_exists('ldap_connect')) { - $settings->add(new admin_setting_heading('enrol_phpldap_noextension', '', get_string('phpldap_noextension', 'enrol_ldap'))); + $notify = new \core\output\notification(get_string('phpldap_noextension', 'enrol_ldap'), + \core\output\notification::NOTIFY_WARNING); + $settings->add(new admin_setting_heading('enrol_phpldap_noextension', '', $OUTPUT->render($notify))); + $settings->add(new admin_setting_heading('enrol_ldap_settings', '', get_string('pluginname_desc', 'enrol_ldap'))); } else { + + $settings->add(new admin_setting_heading('enrol_ldap_settings', '', get_string('pluginname_desc', 'enrol_ldap'))); + require_once($CFG->dirroot.'/enrol/ldap/settingslib.php'); require_once($CFG->libdir.'/ldaplib.php');