1
0
forked from baron/baron-sso

fix: resolve build errors and fix member count synchronization issues in bulk/org-chart import

This commit is contained in:
2026-03-04 17:42:58 +09:00
parent 16ba7ee47a
commit 03e8ed4822
2 changed files with 23 additions and 0 deletions

View File

@@ -530,7 +530,19 @@ func (h *UserHandler) BulkCreateUsers(c *fiber.Ctx) error {
localUser := h.mapToLocalUser(*identity)
_ = h.UserRepo.Update(context.Background(), localUser)
if h.KetoOutboxRepo != nil {
// 1. Sync Role based relationship
h.syncKetoRole(context.Background(), localUser.ID, role, "", "", localUser.TenantID)
// 2. Sync direct membership to the Tenant (for count)
if localUser.TenantID != nil && *localUser.TenantID != "" {
_ = h.KetoOutboxRepo.Create(context.Background(), &domain.KetoOutbox{
Namespace: "Tenant",
Object: *localUser.TenantID,
Relation: "members",
Subject: "User:" + localUser.ID,
Action: domain.KetoOutboxActionCreate,
})
}
}
}
}