forked from baron/baron-sso
fix: align UserGroup ReBAC syncing with Tenant namespace design
This commit is contained in:
@@ -133,9 +133,9 @@ func (s *tenantService) RegisterTenant(ctx context.Context, name, slug, tenantTy
|
||||
// Sync group to Keto via Outbox
|
||||
if s.outboxRepo != nil {
|
||||
_ = s.outboxRepo.Create(ctx, &domain.KetoOutbox{
|
||||
Namespace: "UserGroup",
|
||||
Namespace: "Tenant",
|
||||
Object: newGroup.ID,
|
||||
Relation: "tenants",
|
||||
Relation: "parents",
|
||||
Subject: "Tenant:" + tenant.ID,
|
||||
Action: domain.KetoOutboxActionCreate,
|
||||
})
|
||||
@@ -143,9 +143,9 @@ func (s *tenantService) RegisterTenant(ctx context.Context, name, slug, tenantTy
|
||||
// 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: "UserGroup",
|
||||
Namespace: "Tenant",
|
||||
Object: newGroup.ID,
|
||||
Relation: "members",
|
||||
Relation: "owners",
|
||||
Subject: "User:" + creatorID,
|
||||
Action: domain.KetoOutboxActionCreate,
|
||||
})
|
||||
@@ -276,9 +276,9 @@ func (s *tenantService) ApproveTenant(ctx context.Context, id string) error {
|
||||
if err := s.userGroupRepo.Create(ctx, newGroup); err == nil {
|
||||
if s.outboxRepo != nil {
|
||||
_ = s.outboxRepo.Create(ctx, &domain.KetoOutbox{
|
||||
Namespace: "UserGroup",
|
||||
Namespace: "Tenant",
|
||||
Object: newGroup.ID,
|
||||
Relation: "tenants",
|
||||
Relation: "parents",
|
||||
Subject: "Tenant:" + tenant.ID,
|
||||
Action: domain.KetoOutboxActionCreate,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user