$instance = new GAAuthLdap($auth->id); $instance->set_config('group_synching_ldap_attribute_attribute', $attributename); // override defaut contexts values for the auth plugin if ($onlycontexts) { $instance->set_config('contexts', $onlycontexts); } // OVERRRIDING searchsub contexts for this auth plugin if ($searchsub !== false) { $instance->set_config('search_sub', $searchsub ? 'yes' : 'no'); } if ($CFG->debug_ldap_groupes) { moodle_print_object("config. LDAP : ", $instance->get_config()); } // get the distinct values of the used attribute by a LDAP search // that may be restricted by flags -c or -o $groups = $instance->get_attribute_distinct_values(); if ($CFG->debug_ldap_groupes) { moodle_print_object("distinct values found for {$attributename} ", $groups); } $nbadded = 0; foreach ($groups as $group) { // skip if in excludelist or not in the includelist if (!ldap_sync_filter_name($group, $includelist, $excludelist)) { continue; } if ($CFG->debug_ldap_groupes) { moodle_print_object("processing group : ", $group); } // test whether this group exists within the institution if (!($dbgroup = get_record('group', 'shortname', $group, 'institution', $institutionname))) { if ($nocreate) {