diff --git a/backend/internal/service/tenant_service.go b/backend/internal/service/tenant_service.go index 6a3a3e8a..0e16890d 100644 --- a/backend/internal/service/tenant_service.go +++ b/backend/internal/service/tenant_service.go @@ -112,51 +112,6 @@ func (s *tenantService) RegisterTenant(ctx context.Context, name, slug, tenantTy return nil, err } - // [New] Create Default User Groups - if s.userGroupRepo != nil { - groups := []struct { - Name string - Slug string - }{ - {Name: "임직원", Slug: "members"}, - {Name: "관리자", Slug: "admins"}, - } - - for _, g := range groups { - newGroup := &domain.UserGroup{ - TenantID: tenant.ID, - Name: g.Name, - Slug: g.Slug, - Description: tenant.Name + " " + g.Name + " 그룹", - } - if err := s.userGroupRepo.Create(ctx, newGroup); err == nil { - // Sync group to Keto via Outbox - if s.outboxRepo != nil { - _ = s.outboxRepo.Create(ctx, &domain.KetoOutbox{ - Namespace: "Tenant", - Object: newGroup.ID, - Relation: "parents", - Subject: "Tenant:" + tenant.ID, - Action: domain.KetoOutboxActionCreate, - }) - - // If this is the 'admins' group and we have a creatorID, add creator to this group - if g.Slug == "admins" && creatorID != "" { - _ = s.outboxRepo.Create(ctx, &domain.KetoOutbox{ - Namespace: "Tenant", - Object: newGroup.ID, - Relation: "owners", - Subject: "User:" + creatorID, - Action: domain.KetoOutboxActionCreate, - }) - } - } - } else { - slog.Error("Failed to create default group", "group", g.Slug, "tenant", tenant.ID, "error", err) - } - } - } - // [Keto] Sync hierarchy and ownership via Outbox if s.outboxRepo != nil { // Sync hierarchy @@ -256,37 +211,6 @@ func (s *tenantService) ApproveTenant(ctx context.Context, id string) error { return err } - // [New] Create Default User Groups upon approval - if s.userGroupRepo != nil { - groups := []struct { - Name string - Slug string - }{ - {Name: "임직원", Slug: "members"}, - {Name: "관리자", Slug: "admins"}, - } - - for _, g := range groups { - newGroup := &domain.UserGroup{ - TenantID: tenant.ID, - Name: g.Name, - Slug: g.Slug, - Description: tenant.Name + " " + g.Name + " 그룹", - } - if err := s.userGroupRepo.Create(ctx, newGroup); err == nil { - if s.outboxRepo != nil { - _ = s.outboxRepo.Create(ctx, &domain.KetoOutbox{ - Namespace: "Tenant", - Object: newGroup.ID, - Relation: "parents", - Subject: "Tenant:" + tenant.ID, - Action: domain.KetoOutboxActionCreate, - }) - } - } - } - } - // [Keto] Sync relation via Outbox if s.outboxRepo != nil { if adminEmail, ok := tenant.Config["adminEmail"].(string); ok && adminEmail != "" {