Make enrolling only LDAP users an option
This commit is contained in:
@@ -74,6 +74,8 @@ $string['coursemapping_prefixes_key'] = "Kurs CN Präfix";
|
|||||||
$string['coursemapping_prefixes_desc'] = "Ein Präfix im CN Gruppen Attribut, welches eine Gruppe als Moodle Kurs markiert. Ein * wird als Platzhalter für den restlichen CN Wert eingesetzt";
|
$string['coursemapping_prefixes_desc'] = "Ein Präfix im CN Gruppen Attribut, welches eine Gruppe als Moodle Kurs markiert. Ein * wird als Platzhalter für den restlichen CN Wert eingesetzt";
|
||||||
$string['coursemapping_use_prefixes_key'] = "Kurs CN Präfix verwenden";
|
$string['coursemapping_use_prefixes_key'] = "Kurs CN Präfix verwenden";
|
||||||
$string['coursemapping_use_prefixes_desc'] = "Gibt an, ob das Kurs CN Präfix verwendet werden soll, um Gruppen Kursen zuzuweisen. Hinweis: Das Kurs Attribut hat Vorrang, wenn beide aktiv sind!";
|
$string['coursemapping_use_prefixes_desc'] = "Gibt an, ob das Kurs CN Präfix verwendet werden soll, um Gruppen Kursen zuzuweisen. Hinweis: Das Kurs Attribut hat Vorrang, wenn beide aktiv sind!";
|
||||||
|
$string['coursemapping_map_only_ldap_users_key'] = "Kurse nur LDAP Nutzer/innen zuweisen";
|
||||||
|
$string['coursemapping_map_only_ldap_users_desc'] = "Gibt an, ob Kurse nur Nutzer/innen zugweisen werden sollen, dessen Account via LDAP erstellt wurde";
|
||||||
|
|
||||||
// Course Settings
|
// Course Settings
|
||||||
$string['courses'] = "Kurseinstellungen";
|
$string['courses'] = "Kurseinstellungen";
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ $string['coursemapping_prefixes_key'] = "Course CN Prefix";
|
|||||||
$string['coursemapping_prefixes_desc'] = "A prefix in the group CN attribute which marks IServ groups as Moodle courses. An asterisk (*) is used as placeholder for remaining text in the CN attribute";
|
$string['coursemapping_prefixes_desc'] = "A prefix in the group CN attribute which marks IServ groups as Moodle courses. An asterisk (*) is used as placeholder for remaining text in the CN attribute";
|
||||||
$string['coursemapping_use_prefixes_key'] = "Use course CN prefix";
|
$string['coursemapping_use_prefixes_key'] = "Use course CN prefix";
|
||||||
$string['coursemapping_use_prefixes_desc'] = "Specifies if the course CN prefix is used for mapping. Notice: The course attribute takes precedence when both are active!";
|
$string['coursemapping_use_prefixes_desc'] = "Specifies if the course CN prefix is used for mapping. Notice: The course attribute takes precedence when both are active!";
|
||||||
|
$string['coursemapping_map_only_ldap_users_key'] = "Enrol only LDAP users";
|
||||||
|
$string['coursemapping_map_only_ldap_users_desc'] = "Specifies if only those users shall be enrolled into courses, whose accounts have been created through the LDAP plugin";
|
||||||
|
|
||||||
// Course Settings
|
// Course Settings
|
||||||
$string['courses'] = "Course Settings";
|
$string['courses'] = "Course Settings";
|
||||||
|
|||||||
26
lib.php
26
lib.php
@@ -1329,13 +1329,18 @@ class enrol_iserv_plugin extends enrol_plugin
|
|||||||
if (!is_array($users))
|
if (!is_array($users))
|
||||||
$users = array($users);
|
$users = array($users);
|
||||||
|
|
||||||
|
$user_record_filter = [];
|
||||||
|
if ($this->config->coursemapping_map_only_ldap_users) {
|
||||||
|
$user_record_filter['auth'] = 'ldap';
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($users as $username) {
|
foreach ($users as $username) {
|
||||||
$user = $DB->get_record(
|
$user = $DB->get_record(
|
||||||
'user',
|
'user',
|
||||||
array(
|
[
|
||||||
'username' => $username,
|
...$user_record_filter,
|
||||||
'auth' => 'ldap'
|
'username' => $username
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
@@ -1368,13 +1373,18 @@ class enrol_iserv_plugin extends enrol_plugin
|
|||||||
if (!is_array($users))
|
if (!is_array($users))
|
||||||
$users = array($users);
|
$users = array($users);
|
||||||
|
|
||||||
|
$user_record_filter = [];
|
||||||
|
if ($this->config->coursemapping_map_only_ldap_users) {
|
||||||
|
$user_record_filter['auth'] = 'ldap';
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($users as $username) {
|
foreach ($users as $username) {
|
||||||
$user = $DB->get_record(
|
$user = $DB->get_record(
|
||||||
'user',
|
'user',
|
||||||
array(
|
[
|
||||||
'username' => $username,
|
...$user_record_filter,
|
||||||
'auth' => 'ldap'
|
'username' => $username
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
|
|||||||
@@ -246,6 +246,15 @@ if ($ADMIN -> fulltree) {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$settings->add(
|
||||||
|
new admin_setting_configcheckbox(
|
||||||
|
'enrol_iserv/coursemapping_map_only_ldap_users',
|
||||||
|
get_string('coursemapping_map_only_ldap_users_key', 'enrol_iserv'),
|
||||||
|
get_string('coursemapping_map_only_ldap_users_desc', 'enrol_iserv'),
|
||||||
|
1
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// --- COURSES Settings --- //
|
// --- COURSES Settings --- //
|
||||||
$settings->add(
|
$settings->add(
|
||||||
|
|||||||
Reference in New Issue
Block a user