by Damian Kaliszan.
Thank you I succeeded this one some time ago and currently have two copies of same plugin.
I have two further questions:
1/ How to sync users from second LDAP too? (for regular sync I use the following command: php admin/tool/task/cli/schedule_task.php --execute=\\auth_ldap\\task\\sync_task)
2/ This is more dev question.
In user profile I created addition field called "Group" (it has 2 possible values).
During sync (on clear users table), based on DN or LDAP url I assign users to particular group. This one I can do in auth.php in section starting with "/// User Additions". I'm unable to do the same when given user already exist (in user table) and sync process needs to check/update group based on DN again.
The question is how to enforce to enter the section " if ($do_updates and !empty($updatekeys))" and make it to check if user Group has change? (i.e. LDAP admin changed user DN on some purpose).
In other words every time I call sync I need to change user DN for any update/change.
Hope my quesion is clear
p.s. this piece of code is in charge of adding field key to update keyss
/// User Updates - time-consuming (optional)
if ($do_updates) {
// Narrow down what fields we need to update
$all_keys = array_keys(get_object_vars($this->config));
$updatekeys = array();
foreach ($all_keys as $key) {
if (preg_match('/^field_updatelocal_(.+)$/', $key, $match)) {
// If we have a field to update it from
// and it must be updated 'onlogin' we
// update it on cron
echo "KEY=".$key.", MATCH=".$match[1]."; onlogin=".$this->config->{$match[0]}."\n";
if (!empty($this->config->{'field_map_'.$match[1]})
and $this->config->{$match[0]} === 'onlogin') {
array_push($updatekeys, $match[1]); // the actual key name
}
}
}