(db *db.DatabaseContext, authScope string, ctx context.Context, httpClient *http.Client, managementEndpoints []string, username, password string)
| 704 | } |
| 705 | |
| 706 | func getCBUserRolesForAudit(db *db.DatabaseContext, authScope string, ctx context.Context, httpClient *http.Client, managementEndpoints []string, username, password string) []string { |
| 707 | if !needRolesForAudit(db, base.UserDomainCBServer) { |
| 708 | return nil |
| 709 | } |
| 710 | |
| 711 | whoAmIResponse, whoAmIStatus, whoAmIErr := cbRBACWhoAmI(ctx, httpClient, managementEndpoints, username, password) |
| 712 | if whoAmIErr != nil || whoAmIStatus != http.StatusOK { |
| 713 | base.WarnfCtx(ctx, "An error occurred whilst fetching the user's roles for audit filtering - will not filter: %v", whoAmIErr) |
| 714 | return nil |
| 715 | } |
| 716 | |
| 717 | var auditRoleNames []string |
| 718 | for _, role := range whoAmIResponse.Roles { |
| 719 | // only filter roles applied to this bucket or cluster-scope |
| 720 | if role.BucketName == "" || role.BucketName == authScope { |
| 721 | auditRoleNames = append(auditRoleNames, role.RoleName) |
| 722 | } |
| 723 | } |
| 724 | return auditRoleNames |
| 725 | } |
| 726 | |
| 727 | // removeCorruptConfigIfExists will remove the config from the bucket and remove it from the map if it exists on the invalid database config map |
| 728 | func (h *handler) removeCorruptConfigIfExists(ctx context.Context, bucket, configGroupID, dbName string) error { |
no test coverage detected