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 committed Jul 19, 2024
1 parent a2baa43 commit 7fa80ca
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/RT/Interface/Web.pm
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,18 @@ 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} ) {
if ( ( $UserObj->$attribute // '' ) eq $new_user_info->{$attribute} ) {
RT->Logger->debug("Field $attribute is already set to $new_user_info->{$attribute}, skipping");
next;
}
my ( $ok, $msg ) = $UserObj->$method( $new_user_info->{$attribute} );
unless ($ok) {
RT->Logger->error(
"Couldn't set $attribute to " . $new_user_info->{$attribute}. " for user $user: $msg"
);
}
}
}
$HTML::Mason::Commands::session{'CurrentUser'}->Load($user);
} else {
Expand Down

0 comments on commit 7fa80ca

Please sign in to comment.