Skip to content

Commit

Permalink
emit event on disabling org
Browse files Browse the repository at this point in the history
  • Loading branch information
anujk14 committed Jun 14, 2024
1 parent 26e5c37 commit cb7b3d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/audit/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const (
OrgCreatedEvent EventName = "app.organization.created"
OrgUpdatedEvent EventName = "app.organization.updated"
OrgDeletedEvent EventName = "app.organization.deleted"
OrgDisabledEvent EventName = "app.organization.disabled"
OrgMemberCreatedEvent EventName = "app.organization.member.created"
OrgMemberDeletedEvent EventName = "app.organization.member.deleted"

Expand Down
6 changes: 5 additions & 1 deletion core/organization/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,11 @@ func (s Service) Enable(ctx context.Context, id string) error {
}

func (s Service) Disable(ctx context.Context, id string) error {
return s.repository.SetState(ctx, id, Disabled)
err := s.repository.SetState(ctx, id, Disabled)
if err == nil {
audit.GetAuditor(ctx, id).Log(audit.OrgDisabledEvent, audit.OrgTarget(id))
}
return err
}

// DeleteModel doesn't delete the nested resource, only itself
Expand Down

0 comments on commit cb7b3d0

Please sign in to comment.