Skip to content

Commit

Permalink
Do not pulish empty relationships (#327)
Browse files Browse the repository at this point in the history
Fix bug where identity-api attempts to publish an empty relationship

Signed-off-by: Bailin He <[email protected]>
  • Loading branch information
bailinhe authored Nov 5, 2024
1 parent bdec757 commit d567de4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/events/groups_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ func (e *Events) AddGroupMembers(ctx context.Context, gid gidx.PrefixedID, subjI
)
}

if len(rels) == 0 {
return nil
}

return permissions.CreateAuthRelationships(ctx, GroupTopic, gid, rels...)
}

Expand All @@ -58,6 +62,10 @@ func (e *Events) RemoveGroupMembers(ctx context.Context, gid gidx.PrefixedID, su
)
}

if len(rels) == 0 {
return nil
}

return permissions.DeleteAuthRelationships(ctx, GroupTopic, gid, rels...)
}

Expand Down

0 comments on commit d567de4

Please sign in to comment.