From 484327fd5ffb8941e8005a9ceae9be52b98150aa Mon Sep 17 00:00:00 2001
From: Eric Stroczynski <ericstroczynski@gmail.com>
Date: Thu, 17 Aug 2017 10:13:00 -0700
Subject: [PATCH] connector/github: only user users' login name in API reqs
---
connector/github/github.go | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/connector/github/github.go b/connector/github/github.go
index c3111cbe..d1455d34 100644
--- a/connector/github/github.go
+++ b/connector/github/github.go
@@ -247,16 +247,16 @@ func (c *githubConnector) HandleCallback(s connector.Scopes, r *http.Request) (i
if s.Groups {
var groups []string
if len(c.orgs) > 0 {
- if groups, err = c.listGroups(ctx, client, username); err != nil {
+ if groups, err = c.listGroups(ctx, client, user.Login); err != nil {
return identity, err
}
} else if c.org != "" {
- inOrg, err := c.userInOrg(ctx, client, username, c.org)
+ inOrg, err := c.userInOrg(ctx, client, user.Login, c.org)
if err != nil {
return identity, err
}
if !inOrg {
- return identity, fmt.Errorf("github: user %q not a member of org %q", username, c.org)
+ return identity, fmt.Errorf("github: user %q not a member of org %q", user.Login, c.org)
}
if groups, err = c.teams(ctx, client, c.org); err != nil {
return identity, fmt.Errorf("github: get teams: %v", err)
@@ -303,16 +303,16 @@ func (c *githubConnector) Refresh(ctx context.Context, s connector.Scopes, ident
if s.Groups {
var groups []string
if len(c.orgs) > 0 {
- if groups, err = c.listGroups(ctx, client, username); err != nil {
+ if groups, err = c.listGroups(ctx, client, user.Login); err != nil {
return identity, err
}
} else if c.org != "" {
- inOrg, err := c.userInOrg(ctx, client, username, c.org)
+ inOrg, err := c.userInOrg(ctx, client, user.Login, c.org)
if err != nil {
return identity, err
}
if !inOrg {
- return identity, fmt.Errorf("github: user %q not a member of org %q", username, c.org)
+ return identity, fmt.Errorf("github: user %q not a member of org %q", user.Login, c.org)
}
if groups, err = c.teams(ctx, client, c.org); err != nil {
return identity, fmt.Errorf("github: get teams: %v", err)
--
GitLab