Skip to content

Commit

Permalink
BED-5066: Add duplicate slug check to UpdateSSOProvider as well
Browse files Browse the repository at this point in the history
  • Loading branch information
wes-mil committed Dec 20, 2024
1 parent dbbc6f6 commit 58d510c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/api/src/database/sso_providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ func (s *BloodhoundDB) UpdateSSOProvider(ctx context.Context, ssoProvider model.
if result.Error != nil {
if strings.Contains(result.Error.Error(), "duplicate key value violates unique constraint \"sso_providers_name_key\"") {
return fmt.Errorf("%w: %v", ErrDuplicateSSOProviderName, tx.Error)
} else if strings.Contains(result.Error.Error(), "duplicate key value violates unique constraint \"sso_providers_slug_key\"") {
return fmt.Errorf("%w: %v", ErrDuplicateSSOProviderName, tx.Error)
}
}

Expand Down

0 comments on commit 58d510c

Please sign in to comment.