mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-03-14 08:10:13 +00:00
Don't write the user record every time a user connects via external auth.
This commit is contained in:
parent
11951a09cd
commit
185aeb06bb
@ -99,8 +99,27 @@ function UpdateUserFromExternal( &$usr ) {
|
||||
}
|
||||
|
||||
$qry = new PgQuery("SELECT * FROM usr WHERE user_no = $usr->user_no;" );
|
||||
if ( $qry->Exec('Login',__LINE,__FILE__) && $qry->rows == 1 )
|
||||
if ( $qry->Exec('Login',__LINE,__FILE__) && $qry->rows == 1 ) {
|
||||
$type = "UPDATE";
|
||||
if ( $old = $qry->Fetch() ) {
|
||||
$changes = false;
|
||||
foreach( $usr AS $k => $v ) {
|
||||
if ( $old->{$k} != $v ) {
|
||||
$changes = true;
|
||||
dbg_error_log("Login","User '%s' field '%s' changed from '%s' to '%s'", $usr->username, $k, $old->{$k}, $v );
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !$changes ) {
|
||||
dbg_error_log("Login","No changes to user record for '%s' - leaving as-is.", $usr->username );
|
||||
if ( isset($usr->active) && $usr->active == 'f' ) return false;
|
||||
return; // Normal case, if there are no changes
|
||||
}
|
||||
else {
|
||||
dbg_error_log("Login","Changes to user record for '%s' - updating.", $usr->username );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
$type = "INSERT";
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user