Skip to content

Commit

Permalink
fix: create org member event when the org is created (#797)
Browse files Browse the repository at this point in the history
OrgMemberCreatedEvent was not getting emitted in some of
the situations, it should do now.

Signed-off-by: Kush Sharma <[email protected]>
  • Loading branch information
kushsharma authored Oct 30, 2024
1 parent 65dc0c8 commit 6b4d111
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 5 additions & 0 deletions core/organization/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ func (s Service) AddMember(ctx context.Context, orgID, relationName string, prin
}); err != nil {
return err
}

audit.GetAuditor(ctx, orgID).Log(audit.OrgMemberCreatedEvent, audit.Target{
ID: principal.ID,
Type: principal.Type,
})
return nil
}

Expand Down
4 changes: 0 additions & 4 deletions internal/api/v1beta1/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,6 @@ func (h Handler) AddOrganizationUsers(ctx context.Context, request *frontierv1be
}
}

for _, userID := range request.GetUserIds() {
audit.GetAuditor(ctx, orgResp.ID).Log(audit.OrgMemberCreatedEvent, audit.UserTarget(userID))
}

if err := h.orgService.AddUsers(ctx, orgResp.ID, request.GetUserIds()); err != nil {
return nil, err
}
Expand Down

0 comments on commit 6b4d111

Please sign in to comment.