Skip to content

Commit 892c5de

Browse files
committed
Fixed failover Org-Id usage
1 parent fa6a62b commit 892c5de

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

shared.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3334,7 +3334,9 @@ func HandleApiAuthentication(resp http.ResponseWriter, request *http.Request) (U
33343334
// Get the org
33353335
org, err = GetOrg(ctx, org_id)
33363336
if err != nil || org.Id != org_id {
3337-
return User{}, errors.New("Invalid org id specified")
3337+
//return User{}, errors.New("Invalid org id specified")
3338+
log.Printf("[ERROR] Invalid Org-Id specified: %s", org_id)
3339+
org_id = ""
33383340
}
33393341
}
33403342

@@ -3418,7 +3420,7 @@ func HandleApiAuthentication(resp http.ResponseWriter, request *http.Request) (U
34183420
return User{}, errors.New(fmt.Sprintf("(2) User doesn't have access to this org", org_id))
34193421
}
34203422

3421-
log.Printf("[AUDIT] Setting user %s (%s) org to %#v FROM %#v for one request", userdata.Username, userdata.Id, org_id, userdata.ActiveOrg.Id)
3423+
log.Printf("[AUDIT] Setting user %s (%s) org to %#v FROM %#v for %#v", userdata.Username, userdata.Id, org_id, userdata.ActiveOrg.Id, request.URL.String())
34223424
userdata.ActiveOrg.Id = org_id
34233425
userdata.ActiveOrg.Name = org.Name
34243426
userdata.ActiveOrg.Image = org.Image
@@ -3562,7 +3564,7 @@ func HandleApiAuthentication(resp http.ResponseWriter, request *http.Request) (U
35623564
return User{}, errors.New(fmt.Sprintf("(1) User doesn't have access to this org (%s)", org_id))
35633565
}
35643566

3565-
log.Printf("[AUDIT] Setting user %s (%s) org to %s for one request", user.Username, user.Id, org_id)
3567+
log.Printf("[AUDIT] Setting user %s (%s) org to %s for %#v", user.Username, user.Id, org_id, request.URL.String())
35663568
user.ActiveOrg.Id = org_id
35673569
user.ActiveOrg.Name = org.Name
35683570
user.ActiveOrg.Image = org.Image

0 commit comments

Comments
 (0)