SetAssociatedAccounts, DisassociateAccounts, AssociateAccounts with support for multiple accounts. (#439)

This commit is contained in:
Jim authored and GitHub committed 2020-09-25 13:35:32 -04:00
1 parent 0d75d591d1
commit 21ca0b6388
11 files changed
+1189 -215

No files matched your search

+1 -2
View File
@@ -117,10 +117,9 @@ func (b *Server) CreateInitialAuthMethod(ctx context.Context) (*password.AuthMet
if u, err = iamRepo.CreateUser(cancelCtx, u, opts...); err != nil {
return nil, nil, fmt.Errorf("error creating initial admin user: %w", err)
}
if u, err = iamRepo.AssociateUserWithAccount(cancelCtx, u.GetPublicId(), acct.GetPublicId()); err != nil {
if _, err = iamRepo.AssociateAccounts(cancelCtx, u.GetPublicId(), u.GetVersion(), []string{acct.GetPublicId()}); err != nil {
return nil, nil, fmt.Errorf("error associating initial admin user with account: %w", err)
}
// Create a role tying them together
pr, err := iam.NewRole(scope.Global.String(),
iam.WithName("Generated global scope admin role"),