From d567de457d709557d954c8be6663a9caee1a3623 Mon Sep 17 00:00:00 2001 From: Bailin He <15058035+bailinhe@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:24:36 -0500 Subject: [PATCH] Do not pulish empty relationships (#327) Fix bug where identity-api attempts to publish an empty relationship Signed-off-by: Bailin He --- internal/events/groups_event.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/events/groups_event.go b/internal/events/groups_event.go index 339778e2..ef5af6a9 100644 --- a/internal/events/groups_event.go +++ b/internal/events/groups_event.go @@ -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...) } @@ -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...) }