Skip to content

[management] Skip adding existing users to domain account #3802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bcmmbaga
Copy link
Contributor

@bcmmbaga bcmmbaga commented May 8, 2025

Describe your changes

Issue ticket number and link

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

@bcmmbaga bcmmbaga force-pushed the handle-existing-domain-user branch from 978825e to 1a1e94c Compare May 8, 2025 15:26
Copy link

sonarqubecloud bot commented May 8, 2025

@bcmmbaga bcmmbaga marked this pull request as ready for review May 9, 2025 07:51
@Copilot Copilot AI review requested due to automatic review settings May 9, 2025 07:51
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors account creation and user management by modifying the account creation flow and enhancing error handling when adding a user to a domain account. The changes include a new test (TestDefaultAccountManager_AddNewUserToDomainAccount) to verify user addition behavior and updates to the logic in newAccount and addNewUserToDomainAccount for clearer error handling and existence checks.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
management/server/account_test.go Added a new test to validate behavior for adding both existing and new users to a domain account.
management/server/account.go Refactored newAccount to use a dedicated existence check and improved error handling in addNewUserToDomainAccount.
Comments suppressed due to low confidence (2)

management/server/account.go:486

  • Consider including the accountId in the warning log message to provide clearer context during retries.
log.WithContext(ctx).Warnf("an account with ID already exists, retrying...")

management/server/account.go:1046

  • [nitpick] Consider renaming 'addNewUserToDomainAccount' to 'AddUserToDomainAccount' to better reflect its behavior of handling both new and existing users.
func (am *DefaultAccountManager) addNewUserToDomainAccount(ctx context.Context, domainAccountID string, userAuth nbcontext.UserAuth) (string, error) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant