Skip to content

Commit

Permalink
fix multi auth
Browse files Browse the repository at this point in the history
  • Loading branch information
jswoods committed Dec 6, 2023
1 parent 8b12062 commit ea1b8a2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/humio/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ func (h *ClientConfig) ListAllHumioUsersMultiOrg(config *humioapi.Config, req re
}

variables := map[string]interface{}{
"username": username,
"username": graphql.String(username),
}

err := h.GetHumioClient(config, req).Query(&q, variables)
Expand All @@ -703,7 +703,6 @@ func (h *ClientConfig) ListAllHumioUsersMultiOrg(config *humioapi.Config, req re

var allUserResultEntries []OrganizationSearchResultEntry
for _, result := range q.OrganizationSearchResultSet.Results {
//if result.OrganizationName == "RecoveryRootOrg" {
if result.OrganizationName == organization {
allUserResultEntries = append(allUserResultEntries, result)
}
Expand All @@ -713,15 +712,15 @@ func (h *ClientConfig) ListAllHumioUsersMultiOrg(config *humioapi.Config, req re
}

func (h *ClientConfig) ExtractExistingHumioAdminUserID(config *humioapi.Config, req reconcile.Request, organizationMode string, username string, organization string) (string, error) {
if organizationMode == "multi" {
if organizationMode == "multi" || organizationMode == "multiv2" {
var allUserResults []OrganizationSearchResultEntry
allUserResults, err := h.ListAllHumioUsersMultiOrg(config, req, username, organization)
if err != nil {
// unable to list all users
return "", err
}
for _, userResult := range allUserResults {
if userResult.OrganizationName == "RecoveryRootOrg" {
if userResult.OrganizationName == organization {
if userResult.SearchMatch == fmt.Sprintf(" | %s () ()", username) {
fmt.Printf("Found user ID using multi-organization query.\n")
return userResult.EntityId, nil
Expand Down

0 comments on commit ea1b8a2

Please sign in to comment.