( ctx context.Context, enableUserPermissionStats bool, )
| 621 | } |
| 622 | |
| 623 | func (org *Organization) Audit( |
| 624 | ctx context.Context, |
| 625 | enableUserPermissionStats bool, |
| 626 | ) ([]issue.Issue, map[issue.IssueID]error, error) { |
| 627 | var allIssues []issue.Issue |
| 628 | execStatus := map[issue.IssueID]error{} |
| 629 | |
| 630 | auditHooks := [](func(context.Context) ([]issue.Issue, map[issue.IssueID]error, error)){ |
| 631 | org.AuditCoreStats, |
| 632 | org.AuditWebhooks, |
| 633 | org.Audit2FA, |
| 634 | } |
| 635 | |
| 636 | org.GetInstalls(ctx) |
| 637 | org.GetActionRunners(ctx) |
| 638 | |
| 639 | if enableUserPermissionStats { |
| 640 | auditHooks = append(auditHooks, org.AuditMemberPermissions) |
| 641 | } |
| 642 | for _, hook := range auditHooks { |
| 643 | hookIssues, execResults, err := hook(ctx) |
| 644 | if err != nil { |
| 645 | log.Logger.Error(err) |
| 646 | } |
| 647 | allIssues = append(allIssues, hookIssues...) |
| 648 | for id, err := range execResults { |
| 649 | prevError, ok := execStatus[id] |
| 650 | if !ok { |
| 651 | // this is the first time we see this check |
| 652 | execStatus[id] = err |
| 653 | continue |
| 654 | } |
| 655 | // if we have additional errors just merge them for now |
| 656 | if err != nil { |
| 657 | if prevError != nil { |
| 658 | execStatus[id] = errors.New(err.Error() + prevError.Error()) |
| 659 | } |
| 660 | } |
| 661 | } |
| 662 | } |
| 663 | |
| 664 | org.Summarize() |
| 665 | return allIssues, execStatus, nil |
| 666 | } |
no test coverage detected