Skip to content

Commit

Permalink
Add logging for user attribute setting during auto-creation
Browse files Browse the repository at this point in the history
This change adds error logging for when user attributes fail to be set
during the external user auto-creation process. This helps in diagnosing
issues and ensures better tracking of attribute setting failures.
  • Loading branch information
richieri-bps authored and sunnavy committed Jul 22, 2024
1 parent 2fd079e commit 1b1dfb5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/RT/Interface/Web.pm
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,17 @@ sub AttemptExternalAuth {
CallbackPage => '/autohandler'
);
my $method = "Set$attribute";
$UserObj->$method( $new_user_info->{$attribute} ) if defined $new_user_info->{$attribute};
if ( defined $new_user_info->{$attribute}
&& ( $UserObj->$attribute // '' ) ne $new_user_info->{$attribute} )
{
my ( $ok, $msg ) = $UserObj->$method( $new_user_info->{$attribute} );
if ( $ok ) {
RT->Logger->info("Set $user $attribute to $new_user_info->{$attribute}");
}
else {
RT->Logger->error("Couldn't set $user $attribute to $new_user_info->{$attribute}: $msg");
}
}
}
$HTML::Mason::Commands::session{'CurrentUser'}->Load($user);
} else {
Expand Down

0 comments on commit 1b1dfb5

Please sign in to comment.