Skip to content

Commit

Permalink
fix: bug in appeal creation
Browse files Browse the repository at this point in the history
- bug: if a policy only has auto approval steps, and the appeal gets auto-approved, then with the current logic the appeal is approved but the grant never gets created. Fix this by adding a check
  • Loading branch information
bsushmith committed Sep 18, 2023
1 parent 1d897e8 commit f51f104
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/appeal/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func (s *Service) Create(ctx context.Context, appeals []*domain.Appeal, opts ...
appeal.Policy = nil

for _, approval := range appeal.Approvals {
if approval.Index == len(appeal.Approvals)-1 && approval.Status == domain.ApprovalStatusApproved {
if (approval.Index == len(appeal.Approvals)-1 && approval.Status == domain.ApprovalStatusApproved) || appeal.Status == domain.AppealStatusApproved {
newGrant, revokedGrant, err := s.prepareGrant(ctx, appeal)
if err != nil {
return fmt.Errorf("preparing grant: %w", err)
Expand Down

0 comments on commit f51f104

Please sign in to comment.