mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix Github OAuth not working with private Organizations (#11028)
* Fix Github OAuth not working with private organizations * Update documentation
This commit is contained in:
committed by
Torkel Ödegaard
parent
e67b1ebf33
commit
59704ee939
@@ -195,10 +195,9 @@ func (s *SocialGithub) FetchOrganizations(client *http.Client, organizationsUrl
|
||||
func (s *SocialGithub) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error) {
|
||||
|
||||
var data struct {
|
||||
Id int `json:"id"`
|
||||
Login string `json:"login"`
|
||||
Email string `json:"email"`
|
||||
OrganizationsUrl string `json:"organizations_url"`
|
||||
Id int `json:"id"`
|
||||
Login string `json:"login"`
|
||||
Email string `json:"email"`
|
||||
}
|
||||
|
||||
response, err := HttpGet(client, s.apiUrl)
|
||||
@@ -217,11 +216,13 @@ func (s *SocialGithub) UserInfo(client *http.Client, token *oauth2.Token) (*Basi
|
||||
Email: data.Email,
|
||||
}
|
||||
|
||||
organizationsUrl := fmt.Sprintf(s.apiUrl + "/orgs")
|
||||
|
||||
if !s.IsTeamMember(client) {
|
||||
return nil, ErrMissingTeamMembership
|
||||
}
|
||||
|
||||
if !s.IsOrganizationMember(client, data.OrganizationsUrl) {
|
||||
if !s.IsOrganizationMember(client, organizationsUrl) {
|
||||
return nil, ErrMissingOrganizationMembership
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user