Permalink
Browse files

MDL-39166 auth_ldap Add triggers for user created/updated events.

  • Loading branch information...
1 parent 3a8c438 commit 9b8e4952d4dd9fe72d276389204056336ca011ce @jfilip jfilip committed Apr 17, 2013
Showing with 12 additions and 0 deletions.
  1. +12 −0 auth/ldap/auth.php
View
@@ -589,6 +589,8 @@ function user_confirm($username, $confirmsecret) {
if ($user->firstaccess == 0) {
$DB->set_field('user', 'firstaccess', time(), array('id'=>$user->id));
}
+ $euser = $DB->get_record('user', array('id' => $user->id));
+ events_trigger('user_updated', $euser);
return AUTH_CONFIRM_OK;
}
} else {
@@ -761,6 +763,8 @@ function sync_users($do_updates=true) {
$updateuser->auth = 'nologin';
$DB->update_record('user', $updateuser);
echo "\t"; print_string('auth_dbsuspenduser', 'auth_db', array('name'=>$user->username, 'id'=>$user->id)); echo "\n";
+ $euser = $DB->get_record('user', array('id' => $user->id));
+ events_trigger('user_updated', $euser);
}
}
} else {
@@ -786,6 +790,8 @@ function sync_users($do_updates=true) {
$updateuser->auth = $this->authtype;
$DB->update_record('user', $updateuser);
echo "\t"; print_string('auth_dbreviveduser', 'auth_db', array('name'=>$user->username, 'id'=>$user->id)); echo "\n";
+ $euser = $DB->get_record('user', array('id' => $user->id));
+ events_trigger('user_updated', $euser);
}
} else {
print_string('nouserentriestorevive', 'auth_ldap');
@@ -899,6 +905,8 @@ function sync_users($do_updates=true) {
$id = $DB->insert_record('user', $user);
echo "\t"; print_string('auth_dbinsertuser', 'auth_db', array('name'=>$user->username, 'id'=>$id)); echo "\n";
+ $euser = $DB->get_record('user', array('id' => $user->id));
+ events_trigger('user_created', $euser);
if (!empty($this->config->forcechangepassword)) {
set_user_preference('auth_forcepasswordchange', 1, $id);
}
@@ -969,6 +977,10 @@ function update_user_record($username, $updatekeys = false) {
}
}
}
+ if (!empty($updatekeys)) {
+ $euser = $DB->get_record('user', array('id' => $userid));
+ events_trigger('user_updated', $euser);
+ }
} else {
return false;
}

0 comments on commit 9b8e495

Please sign in to comment.