Skip to content
This repository was archived by the owner on Aug 30, 2025. It is now read-only.

Commit 74a8eae

Browse files
authored
NEOS-1795: personal->team conversion now properly sets up rbac on new personal account (#3421)
1 parent fc32052 commit 74a8eae

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

  • backend/services/mgmt/v1alpha1/user-account-service

backend/services/mgmt/v1alpha1/user-account-service/users.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,16 @@ func (s *Service) ConvertPersonalToTeamAccount(
238238
return nil, err
239239
}
240240

241-
// todo: need to re-upsert rbac for the new personal account.
241+
newPersonalAccountId := neosyncdb.UUIDString(resp.PersonalAccount.ID)
242+
if err := s.rbacClient.SetupNewAccount(ctx, newPersonalAccountId, logger); err != nil {
243+
// note: if this fails the account is kind of in a broken state...
244+
return nil, fmt.Errorf("unable to setup newly converted personal account, please reach out to support for further assistance: %w", err)
245+
}
246+
247+
if err := s.rbacClient.SetAccountRole(ctx, rbac.NewUserIdEntity(user.Msg.GetUserId()), rbac.NewAccountIdEntity(newPersonalAccountId), mgmtv1alpha1.AccountRole_ACCOUNT_ROLE_ADMIN); err != nil {
248+
// note: if this fails the account is kind of in a broken state...
249+
return nil, fmt.Errorf("unable to set account role for user in new personal account, please reach out to support for further assistance: %w", err)
250+
}
242251

243252
var checkoutSessionUrl *string
244253
if s.cfg.IsNeosyncCloud && !resp.TeamAccount.StripeCustomerID.Valid && s.billingclient != nil {

0 commit comments

Comments
 (0)