Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 9a6230c822a054a80fe788fe15c1f4d37eb23650 1 parent dd8e2dd
Justin Filip jfilip authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 auth/ldap/auth.php
12 auth/ldap/auth.php
View
@@ -549,6 +549,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 {
@@ -710,6 +712,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 {
@@ -735,6 +739,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');
@@ -848,6 +854,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);
}
@@ -918,6 +926,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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.