FindNextPendingRole finds the next pending role in the approval flow.
(approval *storepb.IssuePayloadApproval)
| 32 | |
| 33 | // FindNextPendingRole finds the next pending role in the approval flow. |
| 34 | func FindNextPendingRole(approval *storepb.IssuePayloadApproval) string { |
| 35 | if approval == nil || approval.ApprovalTemplate == nil { |
| 36 | return "" |
| 37 | } |
| 38 | // We can do the finding like this for now because we are presuming that |
| 39 | // one role is approved by one approver. |
| 40 | // and the approver status is either |
| 41 | // APPROVED or REJECTED. |
| 42 | if len(approval.Approvers) >= len(approval.ApprovalTemplate.Flow.Roles) { |
| 43 | return "" |
| 44 | } |
| 45 | return approval.ApprovalTemplate.Flow.Roles[len(approval.Approvers)] |
| 46 | } |
| 47 | |
| 48 | // FindRejectedRole finds the rejected role in the approval flow. |
| 49 | func FindRejectedRole(approval *storepb.IssuePayloadApproval) string { |
no outgoing calls
no test coverage detected