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

Commit 06cf6da

Browse files
authored
Adds users todo, adds enforcer auto load policy for syncing (#3415)
1 parent a40c5ef commit 06cf6da

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

  • backend/services/mgmt/v1alpha1/user-account-service
  • internal/ee/rbac/enforcer

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ func (s *Service) ConvertPersonalToTeamAccount(
238238
return nil, err
239239
}
240240

241+
// todo: need to re-upsert rbac for the new personal account.
242+
241243
var checkoutSessionUrl *string
242244
if s.cfg.IsNeosyncCloud && !resp.TeamAccount.StripeCustomerID.Valid && s.billingclient != nil {
243245
account, err := s.db.UpsertStripeCustomerId(

internal/ee/rbac/enforcer/enforcer.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"database/sql"
66
"fmt"
7+
"time"
78

89
sqladapter "github.com/Blank-Xu/sql-adapter"
910
"github.com/casbin/casbin/v2"
@@ -36,7 +37,8 @@ func newEnforcer(
3637
if err != nil {
3738
return nil, fmt.Errorf("unable to initialize casbin synced cached enforcer: %w", err)
3839
}
39-
enforcer.EnableAutoSave(true) // seems to do this automatically but it doesn't hurt
40+
enforcer.EnableAutoSave(true) // seems to do this automatically but it doesn't hurt
41+
enforcer.StartAutoLoadPolicy(time.Second * 10) // allows HA between neosync-api instances or backend changes to RBAC policies to be picked up.
4042
return enforcer, nil
4143
}
4244

0 commit comments

Comments
 (0)